I want to make a script that will check the open windows and call the tts to say open window locations.
The idea I came is to make a template sensor and then vocalize it’s state
But I’m having some troubles with templates. Separetaly the values work great, but the sensors state is Unknown.
- platform: template
sensors:
open_windows:
friendly_name: "Open windows"
value_template: >-
{% if is_state('binary_sensor.0x00158d00040c243c_contact', 'on') %}
Home office
{%- endif %}
{%- if is_state('binary_sensor.0x00158d00042453d7_contact', 'on') -%}
, Kitchen
{%- endif -%}
{%- if is_state('binary_sensor.0x00158d00045086c4_contact', 'on') -%}
, Bed Room
{%- endif -%}
{%- if is_state('binary_sensor.0x00158d00040c2427_contact', 'on') -%}
, Teracce
{% endif %}