Hello,
I am trying to create a sensor which gives me a friendly time (hours and minutes) from another entity.
this is the sensor:
- sensor:
- name: "Waschmaschinen Dauer schön"
unique_id: "waschmaschine_dauer_schon"
unit_of_measurement: min
state_class: total
device_class: timestamp
state: >
{% set hours = states('sensor.waschmaschine_dauer_year') | float %}
{% set total_hours = hours | int %}
{% set minutes = ((hours - total_hours) * 60) | round %}
{{ total_hours }} St. {{ minutes }} Min.
In templating it works perfectly and gives me 106 St. 29 Min.
When I paste the code into a template.yaml package the sensor is not available.
What am I doing wrong?
5 posts - 3 participants