noam76

convert number to HH:MM

Dec 10th, 2019
867
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.61 KB | None | 0 0
  1. I create an input_number -> timer_countdown
  2. I want convert the number to HH:MM
  3.  
  4. The conversion to minutes is working but the hours receive unknown, I try multiple way to convert it
  5.  
  6. MY Sensor:
  7. - platform: template
  8.     sensors:
  9.      timer_int:
  10.       value_template: "{{ states('input_number.timer_countdown') | int }}"
  11.      timer_countdown_min:
  12.       value_template: "{{ states('input_number.timer_countdown') | int %60}}"
  13.  
  14.     ### what is the correct way to do this operation ?###
  15.      timer_countdown_hour:
  16.       value_template: "{{ states('sensor.timer_int') - states('sensor.timer_countdown_min') / 60 }}"
Advertisement
Add Comment
Please, Sign In to add comment