Advertisement
antonio1475

Home Assistant Telegram config

Jan 22nd, 2022
1,507
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. so my configuration.yaml has:
  2. telegram_bot:
  3.   - platform: polling
  4.     api_key: XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXX # your Telegram API key
  5.     allowed_chat_ids:
  6.      - XXXXXXXXXX # bot ID
  7.       - -XXXXXXXXX  # group chat ID
  8.       - XXXXXXXX # chat ID between me and the bot (no group)
  9.       - -XXXXXXXXX  # Sonarr group chat ID
  10.  
  11. notify:
  12.   - name: XXXXXXXXXX # your Telegram username without the @
  13.     platform: telegram
  14.     api_key: XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXX # your Telegram API key
  15.     chat_id: XXXXXXXX # chat ID between me and the bot (no group)
  16.  
  17.  
  18. Then the automation that listens for a Telegram command in a group (or any chat for that matter, I don't know how to filter it to one chat/group chat, is:
  19.  
  20. alias: Scan Plex TV Shows
  21. description: ''
  22. trigger:
  23.   - platform: event
  24.     event_data:
  25.       command: /scan
  26.     event_type: telegram_command
  27.     context: {}
  28. condition: []
  29. action:
  30.     - service: rest_command.scan_plex_tv_shows
  31.     - service: telegram_bot.send_message
  32.       data:
  33.         target: -XXXXXXXXX  # Sonarr group chat ID
  34.         message: Plex TV Shows scan started mode: single
  35.  
  36.  
  37. So even if I text /scan to any chat or group chat where the bot is, HA grabs it, does the thing, but replies "Plex TV Shows scan started" to the specific Sonarr group chat. Multiple ways in (command), one way out (reply).
  38.  
  39. Make sure your bot settings in Telegram (botfather) are all okay and open at least for the setup (group, privacy, etc) and that you talk to the bot for the first time (in groups and directly) since bots aren't allowed to start conversations
  40.  
  41. Try it and go from there? Good luck
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement