Hi.
I am having trouble making my TTS work with message templates.
I am trying to do a welcome home announcement, depending on who just arrived home. The trigger works just fine, but I cant get my message to be played out, when I try working with if/else.
The service of my automation looks like this:
action:
- service: tts.google_say
data_template:
entity_id: media_player.livingroom
message: >
{% if (states.sensor.stue_motion_sensor_temp.state < 20) %}
"Velkommen hjem, WonderMoose. Temperaturen i stuen er '{{ states.sensor.stue_motion_sensor_temp.state | round(0) }}' grader. Måske du burde overveje, at tænde op i brændeovnen."
{% else %}
"Velkommen hjem, WonderMoose. Temperaturen i stuen er '{{ states.sensor.stue_motion_sensor_temp.state | round(0) }}' grader."
{% endif %}
language: "da"
- service: input_boolean.turn_off
entity_id: input_boolean.wondermoose_lige_kommet_hjem
The input boolean turns on when I arrive home, and turns off automatically after 3 minutes, or through this automation.
I cant seem to figure, where the message part dies. I have done this by looking at several examples. The tts works just fine, if I do a simple message with no if/else stuff. And then the boolean also turns off.
With the if/else stuff, the message is not read out, and the boolean is not turned off.