Deprecation of legacy template entities in 2025.12

No.
I am fixing one by one…

I have few sensors fixes like that and cant get it to work:

template:
  - switch:
    - turn_on:
    - entity_id: input_boolean.usisavam_dnevnu_sobu
      action: input_boolean.turn_on
    - data:
      room: living_room
      action: script.usisaj_sobe_po_izboru
      turn_off:
    - entity_id: input_boolean.usisavam_dnevnu_sobu
      action: input_boolean.turn_off
    - action: script.usisavac_stop
    - action: script.usisavac_return_to_base
      default_entity_id: switch.usisaj_dnevnu
      name: Usisaj dnevnu sobu switch
      state: '{{ is_state(''sensor.u_kojoj_sobi_je_usisavac'', ''[1]'') and is_state(''vacuum.dreamebot_l10_pro'', ''cleaning'') }}'

Old one:

  - platform: template
    switches:
      usisaj_dnevnu:
        friendly_name: "Usisaj dnevnu sobu switch"
        turn_on:
        - service: input_boolean.turn_on
          entity_id: input_boolean.usisavam_dnevnu_sobu
        - service: script.usisaj_sobe_po_izboru
          data:
           room: living_room
        turn_off:
        - service: input_boolean.turn_off
          entity_id: input_boolean.usisavam_dnevnu_sobu
        - service: script.usisavac_stop
        - service: script.usisavac_return_to_base
        value_template: "{{ is_state('sensor.u_kojoj_sobi_je_usisavac', '[1]') and is_state('vacuum.dreamebot_l10_pro', 'cleaning') }}"

Indentation is completely off in both that first code blocks.

The new code should be:

template:
  - switch:
    - turn_on:
        - entity_id: input_boolean.usisavam_dnevnu_sobu
          action: input_boolean.turn_on
        - data:
            room: living_room
          action: script.usisaj_sobe_po_izboru
      turn_off:
        - entity_id: input_boolean.usisavam_dnevnu_sobu
          action: input_boolean.turn_off
        - action: script.usisavac_stop
        - action: script.usisavac_return_to_base
      default_entity_id: switch.usisaj_dnevnu
      name: Usisaj dnevnu sobu switch
      state: '{{ is_state(''sensor.u_kojoj_sobi_je_usisavac'', ''[1]'') and is_state(''vacuum.dreamebot_l10_pro'', ''cleaning'') }}'

That is not the repair code you were given. The indentation is all wrong.

When I don’t move them, I get the following errors:

That’s due to the VSCode Home Assistant helper extension giving false positives. Known issue.

Your config is fine.

Getting the following error in the logs and still not working. Is this an indention issue?

The system does boot.

Logger: homeassistant.config
Source: config.py:354
First occurred: 11:16:36 AM (2 occurrences)
Last logged: 11:16:36 AM

Invalid config for ‘template’ at configuration.yaml, line 155: ‘platform’ is an invalid option for ‘template’, check: platform Invalid config for ‘template’ at configuration.yaml, line 156: ‘name’ is an invalid option for ‘template’, check: name Invalid config for ‘template’ at configuration.yaml, line 157: ‘details_format’ is an invalid option for ‘template’, check: details_format Invalid config for ‘template’ at configuration.yaml, line 158: ‘count’ is an invalid option for ‘template’, check: count Invalid config for ‘template’ at configuration.yaml, line 159: ‘leadtime’ is an invalid option for ‘template’, check: leadtime Invalid config for ‘template’ at configuration.yaml, line 160: ‘value_template’ is an invalid option for ‘template’, check: value_template
Invalid config for ‘template’ at configuration.yaml, line 162: ‘platform’ is an invalid option for ‘template’, check: platform Invalid config for ‘template’ at configuration.yaml, line 163: ‘name’ is an invalid option for ‘template’, check: name Invalid config for ‘template’ at configuration.yaml, line 164: ‘value_template’ is an invalid option for ‘template’, check: value_template

You copied the old code into template. The directions say to copy the new code.

Sorry, are you saying the new code automatically generated by the “repair”? Because I’m not getting that.

Then why are you trying to migrate? Only migrate if you get a repair.

I think I found the problem. I missed/deleted the “sensor” below:

sensor:
  - platform: waste_collection_schedule
    name: Trash
    details_format: upcoming
    count: 1
    leadtime: 2
    value_template: '{{value.types|join(", ")}} {% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tonight{% else %}in {{value.daysTo}} Days{% endif %}'

  - platform: waste_collection_schedule
    name: Trash_announcement
    value_template: '{{value.types|join(" and ")}}'

Thanks for everyone’s patience and knowledge. Seems to work now! :slight_smile:

I just wanted to add that while I see a number of people have had difficulty migrating to the new templates, the suggested migration paths in the error fixes were genuinely helpful and worked with a copy/paste for 6 of my legacy templated entities (covers and locks). Thank you!

Ug. Not as bad as some people with only 121 repairs to do. Right now my template sensors are nicely contained in separate files with the rest of the code for that functionality. Eg binary_sensor templates related to my Christmas decorations are all in Christmas.yaml. If I understand this thread correctly I now need to pull all those out and put into a single file and now have functionality spread over multiple files. Ug. This seems like a bad idea that is going to make code management worse.

this shows that you haven’t read the thread :wink:

or possibly the original post.

I try to re-create my sensors (it is only 6, so i try with hand, not migration integration)

So here:

# Template binary sensors
- binary_sensor:
  - default_entity_id: binary_sensor.riaszto_szirena_seged
    name: riaszto_szirena_seged
    unique_id: riaszto_szirena_seged
    device_class: problem
    state: "{{ is_state('switch.shelly1_32c43b', 'on') }}"

  - default_entity_id: binary_sensor.wc_mozgas_seged
    name: "WC virtuális mozgásérzékelő"
    unique_id: wc_mozgas_seged
    device_class: motion
    delay_on:
      seconds: 5
    state: "{{ is_state('binary_sensor.0x54ef44100079a778_occupancy', 'on') }}"

# Template sensors
- sensor:
  - default_entity_id: sensor.current_channel_1
    name: "Shelly EM channel 1 Current"
    unique_id: current_channel_1
    unit_of_measurement: "A"
    device_class: current
    state: "{{ (states('sensor.shellyem_244cab416ef8_channel_1_power')|float(0) / states('sensor.shellyem_244cab416ef8_channel_1_voltage')|float(0)) | round(2) }}"

  - default_entity_id: sensor.weather_wind_dir
    name: "Wind Direction Friendly"
    unique_id: weather_wind_dir
    state: >
      {% set direction = ['É','ÉÉK','ÉK','KÉK','K','KDK','DK','DDK','D','DDNY','DNY','NYDNY','NY','NYÉNY','ÉNY','ÉÉNY','É'] %}
      {% set degree = states('sensor.ijszro2_wind_direction_degrees')|float %}
      {{ direction[((degree+11.25)/22.5)|int] }}

  - default_entity_id: sensor.energy_price
    name: "Áram ár"
    unique_id: energy_price
    unit_of_measurement: "{currency}/kWh"
    state: "{{ 36.4 if states('sensor.aramszamla_seged')|float <= 210 else 70.1 }}"

  - default_entity_id: sensor.energy_price_exceeded_energy
    name: "Túllépte a havi áram kedvezményes keretet?"
    unique_id: energy_price_exceeded_energy
    state: "{{ 'Nem (Havi limit: 210 kWh)' if states('sensor.aramszamla_seged')|float <= 210 else 'Igen (Havi limit: 210 kWh)' }}"

  - default_entity_id: sensor.gas_price
    name: "Gáz ár"
    unique_id: gas_price
    unit_of_measurement: "{currency}/m³"
    state: >
      {% set havi_limitek = [361.19,297.20,244.89,128.22,29.03,0,0,0,30.93,157.69,238.17,336.35] %}
      {% set havi_limit = havi_limitek[now().month - 1] %}
      {{ 102 if states('sensor.gas_consuming_tado')|float <= havi_limit else 747 }}

  - default_entity_id: sensor.energy_price_exceeded_gas
    name: "Túllépte a havi gáz kedvezményes keretet?"
    unique_id: energy_price_exceeded_gas
    state: >
      {% set havi_limitek = [361.19,297.20,244.89,128.22,29.03,0,0,0,30.93,157.69,238.17,336.35] %}
      {% set havi_limit = havi_limitek[now().month - 1] %}
      {{ "Nem (Havi limit: " ~ havi_limit|string ~ " m3)" if states('sensor.gas_consuming_tado')|float <= havi_limit else "Igen (Havi limit: " ~ havi_limit|string ~ " m3)" }}

# Template covers
- cover:
  - default_entity_id: cover.gate_both
    name: "Gate both"
    unique_id: gate_both
    device_class: gate
    state: "{{ is_state('binary_sensor.0x00158d0002fd4303_contact','on') }}"
    icon: "{{ 'mdi:gate-open' if is_state('binary_sensor.0x00158d0002fd4303_contact','on') else 'mdi:gate' }}"
    open_cover:
      action: script.gate_both_open
    close_cover:
      action: script.gate_both_close
    stop_cover:
      action: script.gate_both_stop

  - default_entity_id: cover.gate_left
    name: "Gate left"
    unique_id: gate_left
    device_class: gate
    state: "{{ is_state('binary_sensor.0x00158d0002fd4303_contact','on') }}"
    icon: "{{ 'mdi:gate-open' if is_state('binary_sensor.0x00158d0002fd4303_contact','on') else 'mdi:gate' }}"
    open_cover:
      action: script.gate_left_open
    close_cover:
      action: script.gate_left_close
    stop_cover:
      action: script.gate_left_stop

I delete entities from old file (sensors.yaml for example) but now new ones are not created, if restart my HA

Do you have a template section?

yes i have a templates.yaml file and the include are exist in main configuration.yaml.

These entities are not showing:

binary_sensor.wc_mozgas_seged
sensor.weather_wind_dir
sensor.energy_price
sensor.energy_price_exceeded_energy
sensor.gas_price
sensor.energy_price_exceeded_gas

Others seems exist.

Visual studio code also show these:

You need the template: section in configuration.yaml. Do you have that key in configuration.yaml?

**
image
**

Do you have more than 1 template section?

Exactly what I was looking for. Thanks @petro worked for me (86 template sensors migrated)

1 Like