I am trying to get an automation working. I would like this sequence. 1. Garage door opens. 2. Then back door opens. 3. If this happens, then living room lights on. After it works I will add other things, like time out, and based on time of day. But for now, I just am curious why it doesn’t work. Garage is a MyQ and sensor is a Wyze.
Here is my code
- id: '1583884149495'
alias: Welcome Home
description: ''
trigger:
- entity_id: cover.garage_door
platform: state
to: open
condition:
- condition: state
entity_id: binary_sensor.wyzesense_779034ec
state: 'on'
action:
- data: {}
entity_id: light.36017824d8f15bcba1a1
service: light.turn_on
But also, the way it is now, it is only checking to see if the the back door is open… when the garage door opens… so if the back door isn’t already open when the garage door opens it isn’t going to do anything.
You would probably want to have the back door opening be the trigger, and the condition be if the garage door was opened in the last X amount of time.
Here is an example of something similar… it prevents me from getting an alert that the door was opened after getting alert that someone unlocked it. (obviously if I know someone used their “code” in the door, odds are they are about to open it, so I didn’t need two notifications)
- alias: Door Alert
trigger:
- entity_id: binary_sensor.front_door_opened
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.side_door_opened
from: 'off'
platform: state
to: 'on'
condition:
condition: and
conditions:
- condition: template
value_template: "{{(as_timestamp(now()) - (as_timestamp(states.group.key_group.last_changed))>60)}}"
- condition: time
after: '20:00'
before: '9:00'
action:
- data_template:
message: "{{ trigger.to_state.attributes.friendly_name }} Opened"
service: notify.mobile_app_brians_iphone
So that keeps it from going off within 60 seconds, of a “key” code unlocking the lock.
Hopefully that will get you headed in the right direction…
Brilliant. Thank you, I am going to try this shortly (just have to turn off the automation for announcing the garage door is open so I don’t wake the kids).
I don’t know if you have Alexas but with the Alexa media component, there is a Do not disturb switch… I put all of those in a group and made an automation to turn all announcements off for 30 minutes… comes in handy sometimes when I’m messing around while everyone is sleeping
check this in the template editor you might need less than < for your case, so if the garage door had been opened within the last 300 seconds… with greater than it will only be true if the garage door had been opened more than 300 seconds ago.