hi,
today i updated from 2025.9 to 2026.1 and was shocked by 61 repairs due to âLegacy sensor template deprecationâ
WWHHYYY?

is it possible to mix old and new style in sensor yaml, so i could do one sensor by one? or do i have to clean up all at same time?
e.g. âŚboth in same sensor.yaml?
#old depreciated, but not still migrated
- platform: template
sensors:
# Template sensor for values of power import (active_power > 0)
power_import:
...
#other one, migrated yet...
- default_entity_id: sensor.power_export
unit_of_measurement: W
...
.
.
âŚand what are this â\nâ and âbackslashesâ in state: of repair dialog for? should i clean it up? or could i use simply my old value_template: statement 1:1 for the new state: statement, but only clean up the rest indention and notations?
#migrated example from repair dialog
template:
- binary_sensor:
- device_class: door
default_entity_id: binary_sensor.regensensor_contact_invert
state: "{% if ( (is_state('input_boolean.rainsensor_mainswitch','on')) ) %} \n
\ {{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}\n{% elif ( (is_state('input_boolean.rainsensor_mainswitch','off'))
) %} \n {{ is_state('binary_sensor.aqara_rs_59_contact', 'unavailable') }}\n{%
endif %}\n#{{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}"
name: regensensor_contact_invert
#old sensor, from configuration.yaml
binary_sensor:
# RAIN binary_sensor start
# restartsafe invertsensor
- platform: template
sensors:
regensensor_contact_invert:
value_template: >-
{% if ( (is_state('input_boolean.rainsensor_mainswitch','on')) ) %}
{{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}
{% elif ( (is_state('input_boolean.rainsensor_mainswitch','off')) ) %}
{{ is_state('binary_sensor.aqara_rs_59_contact', 'unavailable') }}
{% endif %}
#{{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}
device_class: door
#new cleaned up for config.yaml
- binary_sensor:
- default_entity_id: binary_sensor.regensensor_contact_invert
state:
" {% if ( (is_state('input_boolean.rainsensor_mainswitch','on')) ) %}
{{ is_state('binary_sensor.aqara_rs_59_contact', 'off') }}
{% elif ( (is_state('input_boolean.rainsensor_mainswitch','off')) ) %}
{{ is_state('binary_sensor.aqara_rs_59_contact', 'unavailable') }}
{% endif %}"
name: regensensor_contact_invert
device_class: door
thanx in advance
br
Frank