Hey Werner,
sure, here are a few examples.
Personally, I find the modern config style to be easier once you get to know it a little better
Legacy
- platform: template
sensors:
arbeitszimmer_luftung_gesamt_minuten:
friendly_name: "Arbeitszimmer Gesamt Lüftung Minuten"
unit_of_measurement: "Min"
value_template: "{{states('sensor.arbeitszimmer_luftung_gesamt')|float * 60 }}"
Modern
template:
- sensor:
- name: "Arbeitszimmer Gesamt Lüftung Minuten"
unit_of_measurement: "Min"
state: "{{states('sensor.arbeitszimmer_luftung_gesamt')|float * 60 }}"
# To add more sensors, simply add them here like this one:
- name: "Another sensor"
state: "OK"
# To add binary sensors do this:
- binary_sensor:
- name: "Example Binary Sensor"
state: "{% if true %}on{% endif %}"
Alternatively, to keep configuration.yaml
clean:
# In configuration.yaml
template: !include template.yaml
# In template.yaml (in the same directory as configuration.yaml)
# Note: Do NOT add "template:" here,
# since you've already done that in configuration.yaml
- sensor:
- name: "Arbeitszimmer Gesamt Lüftung Minuten"
unit_of_measurement: "Min"
state: "{{states('sensor.arbeitszimmer_luftung_gesamt')|float * 60 }}"
# To add more sensors, simply add them here like this one:
- name: "Another sensor"
state: "OK"
# To add binary sensors do this:
- binary_sensor:
- name: "Example Binary Sensor"
state: "{% if true %}on{% endif %}"
Difference - for most sensors:
-
friendly_name:
changes toname:
-
value_template:
changes tostate:
These are the valid modern configuration variables, these are the legacy ones.
Your “Hoftorschalter” (which is a switch
) won’t need to be migrated, the template
integration only supports sensors, binary (on/off) sensors, buttons, numbers and selects. See the second paragraph on the docs page
Everything else will (for now?) stay in their own domain, just like your switch.
So if you have any template (binary) sensors, buttons, numbers, selects, those will have to be migrated (at some point).