noam76 icon

convert number to HH:MM

noam76 | PRO | 12/10/19 12:24:12 PM UTC | 0 ⭐ | 823 👁️ | Never ⏰ | []
YAML |

610 B

|

None

|

0 👍

/

0 👎

I create an input_number -> timer_countdown
I want convert the number to HH:MM
 
The conversion to minutes is working but the hours receive unknown, I try multiple way to convert it
 
MY Sensor:

- platform: template
    sensors:
     timer_int:
      value_template: "{{ states('input_number.timer_countdown') | int }}"
     timer_countdown_min:
      value_template: "{{ states('input_number.timer_countdown') | int %60}}"
 
    ### what is the correct way to do this operation ?###
     timer_countdown_hour:
      value_template: "{{ states('sensor.timer_int') - states('sensor.timer_countdown_min') / 60 }}"

Comments