I’m trying to create a script for daily weather announcements. I have two sensors that contain strings that I intend to feed through TTS in Node-RED. Both of these sensors output the desired strings in Template, but they don’t pass muster when checking configuration:
- sensor:
- unique_id: tts_weather_current
name: TTS Weather Current
state: >
It's currently {{states.sensor.dark_sky_temperature.state|round}} degrees, and feels like {{states.sensor.dark_sky_apparent_temperature.state|round}}.
- sensor:
- unique_id: tts_weather_forecast
name: TTS Weather Forecast
state: >
{% set current = states('sensor.dark_sky_current_text') %}
{% set later = states('sensor.dark_sky_daily_summary') %}
{% if (current == later) %}
It will be {{current}} outside today.
{% else %}
It is {{current}} outside, and it will be {{later}} later today. The apparent high temperature will be #{states('sensor.dark_sky_daytime_high_apparent_temperature_0d')|round}}.
{% endif %}
- sensor:
- unique_id: tts_weather_wind
name: TTS Weather Wind
state: >
{% set current = (states.sensor.dark_sky_wind_speed.state|round) %}
{% set later = (states.sensor.dark_sky_wind_speed_0d.state|round) %}
{% if (current == later) %}
The wind is blowing {{states.sensor.dark_sky_alt_wind.state}} with gusts up to {states.sensor.dark_sky_wind_gust_0d.state|round}}.
{% elif (current > later) %}
The wind is blowing {{ states.sensor.dark_sky_alt_wind.state }}. Later today, the wind speed will decrease to {{ later }} miles per hour #with gusts up to {{states.sensor.dark_sky_wind_gust_0d.state|round}}.
{% else %}
The wind is blowing {{ states.sensor.dark_sky_alt_wind.state }}. Later today, the wind speed will increase to {{ later }} miles per hour #with gusts up to {{states.sensor.dark_sky_wind_gust_0d.state|round}}.
{% endif %}
The error I’m getting is this:
Error loading /config/configuration.yaml: while scanning for the next token
found character '%' that cannot start any token
in "/config/templates.yaml", line 390, column 8
Line 390, column 8 is the first opening bracket ‘{’ in my template sensor tts_weather_forecast
. I’ve included the previous template sensor in case that’s of relevance.
I have no idea what’s happening here. I’ve deleted and retyped, I’ve checked spacing, I’ve changed around the syntax of the variables and state references, and while all of these sensors work in template, they are keeping HA from restarting due to the error. The one clue I have is that Notepad++ bolds the result section of each template sensor, but does not bold from this sensor on:
Apparently, Notepad++ recognizes an issue that I don’t. If I comment out these two sensors, all is well. Any guidance?