Door open for 10 minutes automation > possible in automation editor?

Hi,

starting new with the automation editor (in stead of copy pasting scripts from this site :wink:

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

I’d change the trigger to run every minute:

  trigger:
    - platform: time
      minutes: '/1'
      seconds: 0

and I’d have a list of conditions like so:

 - condition: template
      value_template: '{{(as_timestamp(now()) - as_timestamp(states.sensor.front_door.last_updated) | int > 600 )}}'

Just not sure if you can enter template conditions in the editor yet

Simplest with an alert, rather than an automation.

I agree with @Tinkerer - I’m using an alert:

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.

I get that, but I was trying to do so within the automation editor

There’s no (clean) way to do it with the editor at the moment, because the editor is still a work in progress.

Thanks @chairstacker I wasn’t aware of the alert component.
I’ve got some work to do now :slight_smile:

I had same issue.

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'