With 2025.12.0 I cannot get the formatting right

If I have legacy templates like: ```

  • platform: template
    sensors:
    kitchen_temp:
    friendly_name: “kitchen_temp”
    unit_of_measurement: “°”
    value_template: >-
    {{ (states(‘sensor.hue_kitchen_temp’) | float +4.4) | round(1) }}or
  • platform: template
    sensors:
    xmas_season:
    friendly_name: ‘xmas_season’
    device_class: ‘light’
    value_template: >-
    {{ (states(‘sensor.holiday_xmas_season’) | float >= 0.0 )
    and (states(‘sensor.holiday_xmas_season’) | float < 33.0 ) }}
what should they look like in the new format? 

The documents provided so far only show very simple templates 
I have been unable so far to get these working in a new 
template.yaml file

We are not going to be able to help unless you post your yaml inside code tags, rather than your comments…

Also - what is the actual error reported?

The repairs provide a configuration you can copy and paste for each template entity you have. Take a minute to read the deprecation thread to see where you need to place the new configuration and how you might need to modify it depending on how you have your config set up:

You have 6 months before you need to get this done and Petro is working on a more extensive migration guide. If, after reading the thread linked above, you are still unsure as to how to proceed, you may want to wait until the migration guide is available.

1 Like
template:
  - sensor:
      - name: kitchen_temp
        unique_id: kitchen_temp
        friendly_name: “kitchen_temp”
        unit_of_measurement: “°”
        value_template: >-
          {{ (states(‘sensor.hue_kitchen_temp’) | float +4.4) | round(1) }}or
      - name: xmas_season
        unique_id: xmas_season
        friendly_name: ‘xmas_season’
        device_class: ‘light’
        value_template: >-
          {{ (states(‘sensor.holiday_xmas_season’) | float >= 0.0 )
            and (states(‘sensor.holiday_xmas_season’) | float < 33.0 ) }}

Edit: The above includes ‘fancy quotes’ that were cut and pasted from OP’s original post - so should be changed to remove these.

Where did you put this? If it is inside a file templates.yaml then you need to remove the top line with template: and reduce the indenting one step to match what is already there.

And modern template sensors have a state not a value_template; and no friendly_name.

If that’s genuinely your code as in the YAML rather than just re-pasted from above where the forum had already munged it, you also need to fix all the “smart” quotes.

See here: Template - Home Assistant

If you’re struggling with YAML, use the UI template helpers instead. I used to be a staunch YAML user, eschewing the UI as a n00b tool, but I’ve started using it now for most things.

So I replaced all my binary sensors in binary_sensors.yaml file with the repairs copied from the corresponding legacy_template_depredated messages. Upon reboot I got the following error messages: Preformatted text

Logger: annotatedyaml.constructors
Source: util/yaml/loader.py:65
First occurred: 8:35:11 AM (7 occurrences)
Last logged: 8:35:11 AM

YAML file /config/binary_sensors.yaml contains duplicate key “template”. Check lines 16 and 24
YAML file /config/binary_sensors.yaml contains duplicate key “template”. Check lines 24 and 32
YAML file /config/binary_sensors.yaml contains duplicate key “template”. Check lines 32 and 41
YAML file /config/binary_sensors.yaml contains duplicate key “template”. Check lines 41 and 51
YAML file /config/binary_sensors.yaml contains duplicate key “template”. Check lines 51 and 57

Logger: homeassistant.config
Source: config.py:939
First occurred: 8:35:10 AM (1 occurrence)
Last logged: 8:35:10 AM

Invalid config for ‘binary_sensor’ at configuration.yaml, line 205: required key ‘platform’ not provided, please check the docs at Binary sensor - Home Assistant
Preformatted text So following the suggestion from Didgeridrew did not work. Presumably if I removed all the “template:” lines except for the first one of the errors would disappear but the templat integration would still fail to load.

That is where you go wrong. The new ones belong in templates.yaml if you have that. If you put them there, the template: line above the migrated suggestion must be removed. Also, when placing it in an existing templates.yaml, make sure the indenting matches the other template entities in there.

1 Like