Im trying to create a notification for multiple window sensors. But I keep running into a few errors which I think is an indentation error…im not sure.
Here is the code I cobbled together with help from google:
description: ""
mode: single
triggers:
- trigger: state
entity_id:
- binary_sensor.coralynwindow1_contact
- binary_sensor.coralynwindow2_contact
- binary_sensor.kevinwindow1_contact
from: "off"
to: "on"
actions:
- action: notify.mobile_app_waltercell
message: {{ trigger.to_state.attributes.friendly_name }} was {% if trigger.to_state.state == 'on' %} Open {% else %} Closed {% endif %}
alias: Window Open
Couple things to note if it helps: If I put the message line in quotes " {{trigger…}}" it passes all online yaml checks I can find. But I get a malformed error in HA. If I take out the quotes, It fails both online checks and HA checks with the error falling on line 15 Spot 63 which is the was in the message
Here is the code someone tried to help me with:
alias: Window Open
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.coralynwindow1_contact
- binary_sensor.coralynwindow2_contact
- binary_sensor.kevinwindow1_contact
from: "off"
to: "on"
actions:
- action: notify.mobile_app_waltercell
data:
message: {{ trigger.to_state.attributes.friendly_name + 'was Open'}}
mode: single