That means you didn’t delete the original deprecated yaml definition. Adding unique_id likely hurt you and you’ll probably have to manually go and remove the _2s because those entity ids are now set in stone.
Remove the old definitions. Restart, not reload. Then remove all the _2s manually through the ui.
Sorry, can’t post the old code as I don’t have it when the repair is created. I have a massaged version of the new code only. Otherwise that would have been done
Hmm. I tried commenting out the include-line for my migrated sensors from my configuration.yaml and restart home assistant. After the restart, I went to Settings - Entities.
I found my _2-sensors but they are listed as Integration: Binary Sensor and Integration: Sensor. Their status are unmanageable. They are not selectable via the checkboxes.
After including the migrated sensors file again, the _2-sensors appears as Integration: Template.
They are wiped from configuration.yaml.
The new template definitions goes in a sensor.yaml and a binary_sensor.yaml.
That happened on 2026-01-19 at 08:23.
The repair messages that I had before went away after I made that change. If there was one old entity left in yaml, I guess that would show up as a repair message still, wouldnt it?
And… update, solved!. In my mind, the include-command targeted specifically “sensor.yaml” and “binary_sensor.yaml”. However that was not the case.
The include line looks like this:
And in the directory migrated_templates, in addition to those two new yaml files, I had created a directory where I had put the intermediate yaml files I got from the template helper integration. They were there just for backup. Intention was not to have them loaded. Apparently the include command also recurse the folders.
After moving them out of the config dir structure, I reloaded the yaml and the _2 went away!
The ability to edit the template is all you need in a template entity I’m assuming that if you can create a switch via helper int the UI, it is supporting all you can do via YAML. In the doc there is no mention to differences between a template in the UI and via YAML.
It’s not that simple. It’s possible to do this but it would bring in a slew of other issues that users would do when not following the directions. And it would only work for a small handful of scenarios. To me, its’ not worth the effort because I’ll be hand holding everyone anyways.
I am trying to update my sensors.yaml to the new format.
totally willing to accept this is me not understanding something/missing the obvious, but when i use the new format, the errors go, but the sensors stop working…
any advice gratefully received, been running around in circles for a few days on this now…
this is the old file - that works:
- platform: template
sensors:
battery_charge_discharge:
friendly_name: Battery State
unique_id : 000007
value_template: >-
{{ ['idle', 'charging', 'discharging'][states('sensor.battery_state')|int] }}
icon_template: mdi:battery
battery_out:
friendly_name: "Battery Power Out"
unique_id : 000017
unit_of_measurement: 'W'
device_class: power
value_template: >-
{% set power = (states('sensor.battery_power')|round) %}
{{ 0 if power > 0 else power | abs }}
battery_in:
friendly_name: "Battery Power In"
unique_id : 000018
unit_of_measurement: 'W'
device_class: power
value_template: >-
{% set powerin = (states('sensor.battery_power')|round) %}
{{ 0 if powerin < 0 else powerin }}
grid_export:
friendly_name: "Grid Export"
unique_id : 000020
unit_of_measurement: 'W'
device_class: power
value_template: >-
{% set power = (states('sensor.power_from_grid')|round) %}
{{ 0 if power > 0 else power | abs }}
grid_import:
friendly_name: "Grid Import"
unique_id : 000021
unit_of_measurement: 'W'
device_class: power
value_template: >-
{% set powerin = (states('sensor.power_from_grid')|round) %}
{{ 0 if powerin < 0 else powerin }}
This is the new file - that removes errors but the sensors do not work…from the generated code / suggested fix within the error
template:
- sensor:
- unique_id: '7'
default_entity_id: sensor.battery_charge_discharge
icon: mdi:battery
name: Battery State
state: '{{ [''idle'', ''charging'', ''discharging''][states(''sensor.battery_state'')|int]
}}'
- sensor:
- unique_id: '15'
unit_of_measurement: W
device_class: power
default_entity_id: sensor.battery_out
name: Battery Power Out
state: '{% set power = (states(''sensor.battery_power'')|round) %} {{ 0 if power
> 0 else power | abs }}'
- sensor:
- unique_id: 000018
unit_of_measurement: W
device_class: power
default_entity_id: sensor.battery_in
name: Battery Power In
state: '{% set powerin = (states(''sensor.battery_power'')|round) %} {{ 0 if powerin
< 0 else powerin }}'
- sensor:
- unique_id: '16'
unit_of_measurement: W
device_class: power
default_entity_id: sensor.grid_export
name: Grid Export
state: '{% set power = (states(''sensor.power_from_grid'')|round) %} {{ 0 if power
> 0 else power | abs }}'
- sensor:
- unique_id: '17'
unit_of_measurement: W
device_class: power
default_entity_id: sensor.grid_import
name: Grid Import
state: '{% set powerin = (states(''sensor.power_from_grid'')|round) %} {{ 0 if
powerin < 0 else powerin }}'
and what about to have the ability to “upgrade” your template. First you do the conversion to the new standard using your tool, then, when you open the template from the UI, if it’s compatible with the helper version, you can upgrade it to an helper?