Hi all,
I would like to have some if is_state statements unter the action “entity_id” part, to ensure that my Google Homes do only speak via TTS when there is no music playing on them / no guest is in the guest room.
What am I doing wrong? It looks good in the templates tab.
This is the error log:
Logger: homeassistant.components.automation.notify_for_high_humidity
Source: helpers/script.py:1138
Integration: Automatisierung (documentation, issues)
First occurred: 7:48:21 (1 occurrences)
Last logged: 7:48:21
Notify for high humidity: Error executing script. Invalid data for call_service at pos 2: not a valid value for dictionary value @ data['entity_id']
And then there is a second error. In the last weeks it worked that TTS annonced the correct rooms (see “message” part). Now it doesn say any room anymore. Code wasnt changed.
My code:
action:
- service: tts.google_say
data_template:
entity_id: >
{% if is_state('media_player.wohnzimmer_mini', 'off') %}- media_player.wohnzimmer_mini{%- endif %}
{% if is_state('media_player.schlafzimmer', 'off') %}- media_player.schlafzimmer{%- endif %}
{% if is_state('input_boolean.guest_mode', 'off') %}- media_player.gastezimmer{%- endif %}
message: >
The humidity is too high in the room
{% if (states.climate.gastezimmer.attributes.current_humidity) > 60 %}
Guestroom,
{% endif %}
{% if (states.climate.wohnzimmer.attributes.current_humidity) > 60 %}
Living Room,
{% endif %}
{% if (states.climate.schlafzimmer.attributes.current_humidity) > 60 %}
Sleeping Room,
{% endif %}
{% if (states.climate.bad.attributes.current_humidity) > 60 %}
Bath,
{% endif %}
Please Ventilate.