Today, after updating HA I was presented with 5 repairs all with the same issue regarding the deprecation of the legacy platform: template stating I need to migrate to the modern template syntax:
I took a backup of my existing config and replaced it with the (cleaned up) provided config shown in the screenshot above, but it doesn’t work.
The config I have is:
template:
- binary_sensor:
- name: Teams Meeting
default_entity_id: binary_sensor.teams_meeting
icon:
{ if is_state("binary_sensor.meeting_state_is_in_meeting", "on") }
mdi:phone
{ else }
mdi:phone-off
{ endif }
state:
{ if is_state("binary_sensor.meeting_state_is_in_meeting", "on") }
on
{ else }
off
{ endif }
And when checking the configuration in Developer tools, I get this error:
Configuration errors
Error loading /config/configuration.yaml: while scanning for the next token
found character '\t' that cannot start any token
in "/config/binary_sensor.yaml", line 7, column 1
Although I have been using HA for a few years, I am not really experienced in the yaml config side of things…
I have changed it to this as I think you are saying:
template:
- binary_sensor:
- name: Teams Meeting
default_entity_id: binary_sensor.teams_meeting
state:
{% if is_state("binary_sensor.meeting_state_is_in_meeting", "on") %}
on
{% else %}
off
{% endif %}
But checking the configuration gives me this error now:
Error loading /config/configuration.yaml: while scanning for the next token
found character '%' that cannot start any token
in "/config/binary_sensor.yaml", line 6, column 12