Should it be possible to use templates in TTS


So I have an action inside a blueprint that uses TTS, in this example id like to use {{ friendly_name }}. As you can see it works for the display just fine, however when it comes to TTS it announces friendly_name…

is this maybe a bug/oversight?

Can you post the correctly formatted yaml instead

1 Like

That sounds about right.
You are probably looking for something more like
“{{youractualentityname.attributes.friendly_name}}”`
to state that attribute I’m wild guessing.

Hi,
Here’s a complex working example of TTS templating (with code fences so it is easily readable)…

Good morning.
It is {{ now().hour}} {{ now().minute }} on {{ states('sensor.date_in_text') }}.

The temperature is {{ states('sensor.ds18b20_temperature') }} outside and {{ states('sensor.bedroom_1_pir_air_temperature') }} inside. 

The overnight minimum was {{ states('sensor.shed_minimum_temperature') }}. 

The forecast is {{ forecast_daily['weather.home']['forecast'][0].condition }}. With a temperature of {{ forecast_daily['weather.home']['forecast'][0].temperature|round(1) }},  wind speed of {{ forecast_daily['weather.home']['forecast'][0].wind_speed|round(0) }},  and precip of {{ forecast_daily['weather.home']['forecast'][0].precipitation|round(0) }}

At {{ as_timestamp(forecast_daily['weather.home']['forecast'][0].datetime) | timestamp_custom('%H %M %A') }}

Note the use of conversions in the template functions as entities can return text, floating point numbers, enumerated states, etc.

Basically, use the Settings → Developer Tools → Template Editor to get the templates working first.

1 Like