· 3 years ago · Jan 22, 2022, 06:00 PM
1so my configuration.yaml has:
2
3telegram_bot:
4 - platform: polling
5 api_key: XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXX # your Telegram API key
6 allowed_chat_ids:
7 - XXXXXXXXXX # bot ID
8 - -XXXXXXXXX # group chat ID
9 - XXXXXXXX # chat ID between me and the bot (no group)
10 - -XXXXXXXXX # Sonarr group chat ID
11
12notify:
13 - name: XXXXXXXXXX # your Telegram username without the @
14 platform: telegram
15 api_key: XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXX # your Telegram API key
16 chat_id: XXXXXXXX # chat ID between me and the bot (no group)
17
18
19Then 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:
20
21
22alias: Scan Plex TV Shows
23description: ''
24trigger:
25 - platform: event
26 event_data:
27 command: /scan
28 event_type: telegram_command
29 context: {}
30condition: []
31action:
32 - service: rest_command.scan_plex_tv_shows
33 - service: telegram_bot.send_message
34 data:
35 target: -XXXXXXXXX # Sonarr group chat ID
36 message: Plex TV Shows scan started mode: single
37
38
39So 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).
40
41Make 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
42
43Try it and go from there? Good luck