I am trying to get a variable to be spoken by Google TTS from a wunderground sensor. I think I am getting close, however I cant figure out how to get the variables all the way from the sensor into script.
sequence:
service: tts.google_say
entity_id: media_player.whole_house
data_template:
message: The temperature currently is {{ {states(‘sensor.temp_high_record_f’) }} .’
it just speaks the value of the sensor. Did you remove the extra { ? Mine is also a direct part of an automation, not in a script.
#Weather forecast for the next 24 hours daily at 7pm
- alias: Weather Forecast
trigger:
platform: time
at: '19:00:00'
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.master_bedroom_home
volume_level: 0.5
- service: tts.google_say
entity_id: media_player.master_bedroom_home
data_template:
message: >
The weather for the next 24 hours is {{states ('sensor.dark_sky_hourly_summary') }}
Here is an example of how I did one of my template messages.
- service: notify.bathroom_tablet
data_template:
message: >
Good morning.
It's currently {{states.sensor.dark_sky_summary.state}} and {{states.sensor.dark_sky_temperature.state|round}} degrees.
{% if is_state("sensor.allergy_season", "True") %}
The pollen level for today is {{states.sensor.pollen_level.state}} or {{states.sensor.pollen_index.state}} percent.
{% endif %}
{% if is_state("sensor.flu_season", "True") %}
The flu risk for today is {{states.sensor.cold_flu_risk.state}} or {{states.sensor.cold_flu_percentage.state}} percent.
{% endif %}
Today you can expect {{states.sensor.dark_sky_hourly_summary.state}}.
With a high of {{states.sensor.dark_sky_daily_high_temperature.state|round|int}} and a low of {{states.sensor.dark_sky_daily_low_temperature.state|round|int}}.
{% if states.sensor.dark_sky_wind_speed.state|int > 10 %}
Be advised it is windy outside.
{% endif %}
{% if states.sensor.to_lafontaine.state|int > 40 %}
Be advised the travel time to lafontaine is over 40 mintues today.
{% endif %}