Hi There,
i was referring to this post https://community.home-assistant.io/t/send-entity-state-to-notification-using-ha-automations/150181
this got me what i needed for my home alarm telegram notification to tell me what sensor friendly name triggered, and what the state is. however, i’m monitoring doors/windows opening when the alarm panel is armed. i have my device classes set proper, but that only seems to adjust the UI state string (instead of on/off, the ui shows open/closed).
when i get the notification event, i get the state as “on” and ‘off’ . i want it to parse to show opened/closed
how could i write that in the data_template?
this is what i have now
- service_template: notify.telegram_alert
data_template:
title: "[Alarm] Triggered"
message: >
"The {{ trigger.to_state.attributes.friendly_name }} has {{ trigger.to_state.state}} !"
i saw on the automation templating page in home assistant, that they show a test for when you are manually trying to test the data, can something like this be used within my data template to parse the string to what i want?
{% set trigger={'to_state':{'state': 'heat'}} %}
{% set option = trigger.to_state.state %}
{{ 'on' if option == 'heat' else 'off' }}