Deprecation of legacy template entities in 2025.12

Hi i tried removing this, but it made no difference,

the start of my config file looks like this:

# Loads default set of integrations. Do not remove.
default_config:

homeassistant:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
switch: !include switches.yaml
#weather: !include forecast.yaml
template: !include templates.yaml
#template: !include_dir_merge_list templates/ # includes .yaml files located in config/templates
#climate: !include climate.yaml

# enable https

this is the adjusted sensors.yaml

# sensors.yaml

# Victron Configuration.  // If you require stats from your victron system you must have a Venus device installed as part of your Victron installation. This does not use VRM.This users MODBUS

#template:
- sensor:
  - unique_id: 000007
    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: 000017
    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 }}

sorry if this is obvious to everyone… :frowning:

There should be a templates.yaml file.

hi my templates yaml looks like this

# templates.yaml

# Total Solar power in
sensor:
    - name: "total solar in"
      #friendly_name: "Total Solar In"
      unique_id: 000019
      unit_of_measurement: W
      device_class: power
      state: >
          {{ [ states('sensor.compost_power'),
               states('sensor.roof_pv_power'), states('sensor.rear_wall_power') ]
               | map('float') | sum }}
      availability: >
          {{ not 'unavailable' in 
             [ states('sensor.compost_power'), 
               states('sensor.roof_pv_power'), states('sensor.rear_wall_power')  ] }}

should i move the new sensor code into this and simply remove the sensors.yaml?

maybe this is why i cannot get it to work?

Hi, have you looked at the link I posted here?

It has a step by step process that tells you exactly what to do. To me, it seems you haven’t read it. Step 2 covers where the new templates should go.

I did the migration a month ago by copy paste over each entity, I didn’t look at it in detail…
But now I notice I have everywhere double ’ ’

See example. Is this normal? It works , but it’s failing for example in the template editor…

Should I change them all back to single ’ ?

state: '{{ is_state(''input_boolean.keukendeur'', ''on'' ) }}'
position: '{% if is_state(''input_boolean.keukendeur'', ''on'') %} 100 {% else %} 0 {% endif %}'

That’s normal, it’s an escaped quote.

1 Like

What made you think I didn’t read it?

Probably the fact that having 300+ repairs is not an issue as there is a way to fix that all at once described in the first post.

1 Like

This is not necessarily true for everyone, particulary for those that organize everything in a bunch of different files.

I truly appreciate the tool being available as it helps a great deal. However, the generated state definitions have a lot of escape sequences which need to be replaced with the original code for better readability and maintainability. After that, everything needs to be manually copied / pasted to their respective files.

So all in all and unfortunately for me, all required work demands more time than I have or can afford now or in the intermediate future.

The tool formats it without the escape sequences. The repair does not. Are you sure you used the tool?

1 Like

It feels like you spent more time thinking through and writing out your response than downloading the integration and trying it out. It took me all of 15 mins to update mine including the removal of the tool. It’s really very good.

Yep. The output YAML files contained escape aequences for me unfortunately.

Apparently your feeling was wrong.

Can you please post the proof?

Some examples among many.

can you post your original/legacy configuration for that?

Here’s a different example:

#Legacy
- platform: template
  sensors:
    downstairs_presence:
      value_template: >-
        {% 
          if is_state('binary_sensor.living_room_presence','on') or 
          is_state('binary_sensor.dining_room_presence','on') or 
          is_state('binary_sensor.kitchen_presence','on') 
        %}
          on
        {% else %}
          off
        {% endif %}

#Tool generated
- binary_sensor:
  - default_entity_id: binary_sensor.downstairs_presence
    state: "{% \n  if is_state('binary_sensor.living_room_presence','on') or \n  is_state('binary_sensor.dining_room_presence','on')\
      \ or \n  is_state('binary_sensor.kitchen_presence','on') \n%}\n  on\n{% else\
      \ %}\n  off\n{% endif %}"
    name: downstairs_presence

Here’s one corresponding to the screenshot:

bedroom_dresser_fan_speed:
  value_template: > 
    {% if states('sensor.bedroom_dresser_fan_power') | float(0) >= 40 %}
      3
    {% elif states('sensor.bedroom_dresser_fan_power') | float(0)>= 30 %}  
      2
    {% elif states('sensor.bedroom_dresser_fan_power') | float(0) >= 20  %}    
      1
    {% else %}
      0
    {% endif %}
  icon_template: >
    {% if is_state('sensor.bedroom_dresser_fan_speed','3') %}
      mdi:fan-speed-3
    {% elif is_state('sensor.bedroom_dresser_fan_speed','2') %}
      mdi:fan-speed-2
    {% elif is_state('sensor.bedroom_dresser_fan_speed','1') %}
      mdi:fan-speed-1
    {% else %}
      mdi:fan-off
    {% endif %}

Why are they in sensor.yaml? The custom integration converter tool wouldn’t have done that.

Don’t ask me. I didn’t make the tool.