Team,
Just going through my configuration.yaml when I noticed that I have 2 ways of configuring sensors.
- Template with a sensor
- Sensor with a template
???
Example:
template:
- sensor:
- name: "e-usage sensor"
unit_of_measurement: "kWh"
state: "{{ (states('sensor.electricity_lamp1') | float(0)) | round(2) }}"
device_class: energy
state_class: measurement
And also sensors that have templates in them? Example:
sensor:
- platform: template
sensors:
ha_uptime_minutes:
friendly_name: HA Uptime Minutes
value_template: >
{{ (as_timestamp(now()) - as_timestamp(states('sensor.ha_uptime'))) // 60| round (0) }}
Did I miss overlook in the documentation? What is the difference and when should I use one or the other?
BTW, I keep reading about “legacy templates” and “modern templates” but was unable to find the difference.