I created an automation in HA that looks like this and works fine. It triggers when the sensor is turned on. Can I adjust it so that it sends the message again every 5 minutes, for example, until the sensor status is turned off again?
- id: '1234567890'
alias: Telegram_Garagedeur_OPEN
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.garagedeur_input_100
from:
- 'off'
to:
- 'on'
conditions: []
actions:
- action: telegram_bot.send_message
metadata: {}
data:
config_entry_id: 03KE62HST543SBDH789DKW5
message: Garagedeur is OPEN
title: Waarschuwing !!
target:
- '007'
mode: single
Thanks, I found it, and everything works fine. Except for the time delay function. If I set the condition “Sensor equals ON” for a duration of 5 minutes, the action isn’t executed. Only if there’s no duration, the action is executed immediately. It would be great if I could wait 5 minutes after the sensor is set to ON before the action is executed.
To delay the trigger so that the door must be open for a certain amount of time before the actions are executed, you can add a duration with the for key:
- trigger: state
entity_id: binary_sensor.garagedeur_input_100
from: 'off'
to: 'on'
for: "00:05:00"
Then, to delay how often the message is sent you’ll need to use a Delay action inside the Repeat action’s sequence. In the UI selector, the Delay action is in “Blocks” as well… at the bottom under “Wait for time to pass(delay)”:
Putting it all together:
- id: '1234567890'
alias: Telegram_Garagedeur_OPEN
description: ''
triggers:
- trigger: state
entity_id: binary_sensor.garagedeur_input_100
from: 'off'
to: 'on'
for: "00:05:00"
conditions: []
actions:
- repeat:
until:
- condition: state
entity_id: binary_sensor.garagedeur_input_100
state: "off"
sequence: []
- action: telegram_bot.send_message
metadata: {}
data:
config_entry_id: 03KE62HST543SBDH789DKW5
message: Garagedeur is OPEN
title: Waarschuwing !!
target:
- '007'
- delay: "00:01:00"
mode: single