starting new with the automation editor (in stead of copy pasting scripts from this site
im stuck now
is it possible to build the door open for 10 minutes automation in automation editor?
source: jbardi
alias: ‘Notify if any doors left open for 10 minutes’
trigger:
platform: state
entity_id:
- sensor.front_door
- sensor.back_door
- sensor.garage_side_door
- sensor.garage_overhead_door
state: ‘on’
for:
minutes: 10
action:
service: notify.notify
data_template:
message: >
The {{ trigger.to_state.attributes.friendly_name }} was left open
alert:
garage_door_open_long:
name: Garage Door is still open!
entity_id: binary_sensor.garage_door_sensor
state: 'off' # Optional, 'on' is the default value
repeat: 5
can_acknowledge: true # Optional, default is true
skip_first: true # Optional, false is the default
notifiers:
- mypushbullet
If you want to use it for a number of sensors with one alert, I think it might be good to put them into a group.
Alert works only with notifies, but I want take a action such as call a buzzer through mqtt for each 2 min while gate is opened.
Here is my solution with Automation:
- id: 'notify_door_open'
action:
- service: script.turn_on
entity_id: script.alarm_buzzer_gate_open # this script publish a mqtt msg
- delay: '00:02:00' ## Wait 2 minute
- event: event_call_buzzer # Start the event (loop)
alias: 'Notify Buzzer: Door Opened'
hide_entity: True
trigger:
- platform: event
event_type: event_call_buzzer # Execute automation when Event was Started
- platform: state
entity_id: sensor.front_door
to: 'Open'
condition: # This is necessary to prevent buzzer be called with door closed
- condition: or
conditions:
- condition: state
entity_id: sensor.front_door
state: 'Open'