neildeadman
(Neil McKirdy-Deadman)
December 4, 2025, 6:29pm
1
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…
See this thread - especially the first post.
TLDR: Legacy template entities (alarm_control_panel, binary_sensor, cover, fan, light, lock, sensor, switch, vacuum, weather) are being deprecated in 2025.12. Legacy template entities will no longer work after 2026.6. I wanted to avoid the deprecation, however it’s apparent that it’s not possible due to future plans.
Do not use AI to migrate. AI will screw up the yaml. Use the tools provided in this post, if you use AI you are on your own.
The Deprecation
Please use this thread to ask ques…
neildeadman
(Neil McKirdy-Deadman)
December 4, 2025, 6:32pm
3
The \t was bugging me, so I pasted the code into a linux box and it showed some incorrect formatting so I corrected that and now get:
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 }
petro
(Petro)
December 4, 2025, 6:33pm
4
You are mixing tabs and spaces inside yaml, that’s a no-no. You have to use tabs or spaces, not both.
That’s what the \t was referring to.
1 Like
JefferMC
(J Corbett)
December 4, 2025, 6:36pm
5
Agree with petro, YAML is hung up on spacing. You may have to “de-pretty” your expression.
All of your delimiters are missing their %…
{ if is_state("binary_sensor.meeting_state_is_in_meeting", "on") }
should be:
{% if is_state("binary_sensor.meeting_state_is_in_meeting", "on") %}
Edwin_D
(Edwin D.)
December 4, 2025, 6:44pm
7
Could it be you were using an editor that decided it replace spaces with tabs?
edit: oh, I see I’m a bit late to the party
1 Like
neildeadman
(Neil McKirdy-Deadman)
December 4, 2025, 6:47pm
8
Thanks all, I have ensured I am only using spaces in the config now. Suspected it was something like that, but posted before checking (my bad).
neildeadman
(Neil McKirdy-Deadman)
December 4, 2025, 6:48pm
9
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
Edwin_D
(Edwin D.)
December 4, 2025, 6:49pm
10
neildeadman:
state:
put a | behind that line to make it a multiline
state: |
1 Like
You’re missing the multi-line quote indicator:
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 %}
neildeadman
(Neil McKirdy-Deadman)
December 4, 2025, 6:50pm
13
That now gives this warning:
Invalid config for 'binary_sensor' at configuration.yaml, line 18: required key 'platform' not provided
Can the warning be ignored?
template doesn’t go in binary_sensor.yaml…
There are multiple examples in the thread @PecosKidd linked above.
neildeadman
(Neil McKirdy-Deadman)
December 4, 2025, 6:55pm
15
I promise I did look there before @PecosKidd mentioned it and tried some, but couldn’t get it to work. I probably missed the | for multilines.
Thank you all!
1 Like
How to do this in split yaml files? Because I get this error :
Invalid config for 'template' at entities/templates/binary_sensors/smoke.yaml, line 2: 'binary_sensor' is an invalid option for 'template', check: binary_sensor->0->binary_sensor Invalid config for 'template' at entities/templates/binary_sensors/smoke.yaml, line 2: required key 'state' not provided
---
binary_sensor:
- default_entity_id: binary_sensor.rooksensor_overloop
icon: '{{ ''mdi:smoke-detector-variant-alert'' if this.state|int(default=0) >
0 else ''mdi:smoke-detector-variant-off'' }}'
name: Rooksensor Overloop
state: '{{ states.binary_sensor.smoke_sensor_overloop_smoke_detected.state }}'
- default_entity_id: binary_sensor.rooksensor_overloop
icon: '{{ ''mdi:smoke-detector-variant-alert'' if this.state|int(default=0) >
0 else ''mdi:smoke-detector-variant-off'' }}'
name: Rooksensor Keuken
state: '{{ states.binary_sensor.smoke_sensor_keuken_smoke_detected.state }}'
- default_entity_id: binary_sensor.rooksensor_zolder
icon: '{{ ''mdi:smoke-detector-variant-alert'' if this.state|int(default=0) >
0 else ''mdi:smoke-detector-variant-off'' }}'
name: Rooksensor Zolder
state: '{{ states.binary_sensor.smoke_sensor_zolder_smoke_detected.state }}'
petro
(Petro)
January 28, 2026, 3:20pm
18
you have to show how you included it.
Sure
My configuration.yaml:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
homeassistant:
customize: !include customize.yaml
# Load packages
packages: !include_dir_named packages
automation: !include automations.yaml
#script: !include scripts.yaml
scene: !include scenes.yaml
And then in packages folder I have a template.yaml:
---
template: !include_dir_list ../entities/templates
And in entities/templates dir I have a binary_sensors folder with a file smoke.yaml:
---
binary_sensor:
- default_entity_id: binary_sensor.rooksensor_overloop
icon: '{{ ''mdi:smoke-detector-variant-alert'' if this.state|int(default=0) >
0 else ''mdi:smoke-detector-variant-off'' }}'
name: Rooksensor Overloop
state: '{{ states.binary_sensor.smoke_sensor_overloop_smoke_detected.state }}'
- default_entity_id: binary_sensor.rooksensor_overloop
icon: '{{ ''mdi:smoke-detector-variant-alert'' if this.state|int(default=0) >
0 else ''mdi:smoke-detector-variant-off'' }}'
name: Rooksensor Keuken
state: '{{ states.binary_sensor.smoke_sensor_keuken_smoke_detected.state }}'
- default_entity_id: binary_sensor.rooksensor_zolder
icon: '{{ ''mdi:smoke-detector-variant-alert'' if this.state|int(default=0) >
0 else ''mdi:smoke-detector-variant-off'' }}'
name: Rooksensor Zolder
state: '{{ states.binary_sensor.smoke_sensor_zolder_smoke_detected.state }}'
petro
(Petro)
January 28, 2026, 3:38pm
20
use
template: !include_dir_merge_list ../entities/templates
Then name the files whatever you want and keep the content’s what you already have but add a - in front of binary_sensor:.
- binary_sensor:
- default_entity_id: ....
...
You won’t be able to use sub folders, so just name it smoke.yaml and put all template entities related to smoke inside it. e.g.
- binary_sensor:
- default_entity_id: ....
...
- switch:
- default_entity_id: switch.foo
....
- light:
- default_entity_id: light.foo
....