I want to send myself a message when everyone has left the house but there are still doors/windows open. The following works, but I would like to include a list in the message of exactly which doors/windows are still open. Any suggestions on how to achieve that? Any help is greatly appreciated!
I’m trying to do the exact same thing but it’s not working like I’d hoped.
- alias: Open Door Nobody Home
trigger:
- platform: zone
entity_id: device_tracker.a_s_iphone_ios, device_tracker.brads_iphone_ios
zone: zone.home
event: leave
condition:
condition: and
conditions:
- condition: state
entity_id: group.millers_home
state: "not_home"
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.l_garage_opened
state: 'on'
- condition: state
entity_id: binary_sensor.r_garage_opened
state: 'on'
- condition: state
entity_id: binary_sensor.front_door
state: 'on'
- condition: state
entity_id: binary_sensor.side_door
state: 'on'
- condition: state
entity_id: binary_sensor.deck_slider
state: 'on'
- condition: state
entity_id: binary_sensor.patio_slider
state: 'on'
action:
service: notify.mobile_app_brads_iphone
data_template:
message: '{{ trigger.to_state.friendly_name }} is open and nobody is home!'
This will send a message when one of us leaves and the group is not home BUT it doesn’t include what is exactly open. I’ve used the “trigger.to_state.friendly_name” to push out what caused the automation to run and yes I know, the condition is not the trigger.
For example, this works to tell me when a garage door is opened:
- alias: Garage Door Opened
trigger:
- platform: state
entity_id: binary_sensor.l_garage_opened, binary_sensor.r_garage_opened
to: 'on'
action:
service: notify.mobile_app_brads_iphone
data_template:
message: 'The {{ trigger.to_state.name }} was opened! - {{now().strftime("%H:%M:%S on %m/%d/%y")}}'
I guess I needed something like a “condition.on_state.friendly_name”. I’ve tried to find something like that but have come up blank. I’ll try out the post above as well to see if I can get it to work.
@123 Just wanted to report back that this works, thanks!
Quick question: besides binary sensors, I’d also like to include some covers, which have “open” as the state. So I woul like to select all the entities in the group that have the state “on” OR “open”. Can you help me with the proper syntax for that?
If the group contains binary_sensors and covers, and you want to know which ones are either on or open, you only need to make a small change to the active variable’s template: