Hello,
I want to loop my automation. When network devices are turned off I want the telegram bot to send a message something like: There is a problem with a network device. I already have that working. Now I want to loop the message until someone answers in the group chat: Ok or Stop. I was looking for other topics but i cant figure it out. I am new to home assistant. Can someone help me out?
this is what i have( currently used with a dummy switch).
- id: '1585574182630'
alias: teststan
description: ''
trigger:
- entity_id: switch.dummy
from: 'on'
platform: state
to: 'off'
condition: []
action:
- data:
message: Test
service: notify.wifibot
This automation just runs on a timer. The only way for it to stop running is to turn it off
- alias: telegram_spam_bot
trigger:
# This automation runs every 5 minutes if it's enabled....
- platform: time_pattern
# "/X" means when the field is divisible by this number, it triggers.
# So in this case, a XX:05, XX:10, XX:15 ....
minutes: "/5"
action:
- data_template:
message: |-
{% set name = state_attr('switch.dummy', 'friendly_name') %}
Hello, you have subscribed to {{ name }} facts.
Did you know, {{ name }}'s favorite thing is to not be off?
Well, it's off.
Respond 'OK' to unsubscribe from {{ name }} facts!
service: notify.wifibot
Finally, one more automation to receive messages on telegram to turn that one off. I do not use telegram, so you’ll have to figure this one out.
- alias: 'Telegram bot that simply acknowledges'
trigger:
# The secret sauce to parse telegram replies for you to figure out!!
action:
- service: automation.turn_off
entity_id: automation.telegram_spam_bot