I am trying to set up an automation that will let us know when any of the entry doors are opened when no one is home or if it is after sunset. I did some searching and think I have the trigger set (you can use multiple entities there can’t you?) correctly. I also wanted to capture which had been opened instead of some generic message. Again, some searching and I found reference to the {{ trigger.to_state.attributes.friendly_name }} template. However, when I run the automation, I am getting all kinds of errors and if I am reading the errors correctly, it appears to be taking exception with the trigger portion.
Anyone have any suggestions? Is there a better way to do this or do I need to list the triggers differently? It would seem like I need some kind of OR statement in the trigger, but I am not sure how to do that.
- id: OpenEntryDoor
alias: Open Entry Door
initial_state: 'on'
trigger:
- platform: state
entity_id:
- binary_sensor.aeotec_zw112_door_window_sensor_6_sensor_3
- binary_sensor.aeotec_zw112_door_window_sensor_6_sensor_2
- binary_sensor.aeotec_zw112_door_window_sensor_6_sensor_4
from: 'off'
to: 'on'
condition:
condition: or
conditions:
- condition: state
entity_id: sun.sun
state: below_horizon
- condition: state
entity_id: group.all_devices
state: 'not_home'
action:
- service: notify.sms_a
data:
title: OPENED-DOOR
message: The {{ trigger.to_state.attributes.friendly_name }} door has been opened.
- service: notify.sms_b
data:
title: OPENED-DOOR
message: The {{ trigger.to_state.attributes.friendly_name }} door has been opened.