Hopefully in the right place - first time on the forum.
I’d like to create an automation that responds to a telelgram trigger with all the open zones in an alarm - for the life of me I can’t find anything similiar trying to google it - is it possible?
The trigger part is simple - the action then returns a message with all sensors where the State is ON/Open/etc?
A quick modification to hard code ‘on’, try it in the dev templates page
{%- for state in states.switch -%}
{%- if state.state == 'on' -%}
{%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
{{ state.name }} status is {{ state.state }} {{- state.attributes.unit_of_measurement}}
{%- endif -%}
{%- else -%}
Sorry, I can't find anything in state of on
{%- endfor -%}
{%- for state in states.binary_sensor -%}
{%- if state.state == 'on' -%}
{%- if loop.first %}The {% elif loop.last %} and the {% else %}, the {% endif -%}
{{ state.name }} status is {{ state.state }} {{- state.attributes.unit_of_measurement}}
{%- endif -%}
{%- else -%}
Sorry, I can't find anything in state of on
{%- endfor -%}