i get notifications via Telegram. can i set up actions in HA by simply typing a command?
for example, i would like to type “SIREN OFF” or “SIREN_OFF” to turn off the siren manually.
in my automation i have this and it does absolutely nothing:
alias: 'telegram listener SIREN OFF '
trigger:
- platform: event
event_type: telegram_notification_action
event_data:
action: SIREN OFF
action:
- service: switch.turn_off
entity_id: switch.elexa_consumer_products_inc_dome_siren_switch
- service: notify.telegram
data:
message: siren now off
mode: single
yes, i saw that. but it looks like HA has to initiate the conversion and provide buttons for me to press, correct? i want to initiate the conversation so i wont have buttons.
for instance, if i want to check if my doors are locks, i would like to ask Telegram “door status” and HA will auto respond if my doors are on or off.
No, you can just type a command to the bot and have it do something when it get’s a specific message.
Look at the event-triggering section of the docs.
For example if I text my bot the command “/ip” it will reply with the current external IP of my HA server.
- id: 'telegramipcallback'
alias: 'Telegram callback for IP'
trigger:
platform: event
event_type: telegram_command
event_data:
command: '/ip'
action:
- service: notify.tg_notification_chat
data_template:
title: "From Home-Assistant:"
message: "Your External IP is {{states('sensor.external_ip')}}"