I thought I’d share a variant of a time slider to set a HH:MM value. It looks like this:
This is the config:
input_number:
nattvak:
name: Välj
icon: mdi:cursor-pointer
initial: 25
min: 23
max: 28
step: 0.5
sensor:
platform: template
sensors:
nattvakstid:
friendly_name: 'Tid att kolla'
value_template: >
{%- if states("input_number.nattvak") |float < 24 %}
{% set nighthour = states("input_number.nattvak") | int %}
{% else %}
{% set nighthour = (states("input_number.nattvak") | float - 24) | int %}
{% endif -%}
{% set nightminute = ((states("input_number.nattvak") | float - states("input_number.nattvak") | int) * 60) | int %}
{{ "%0.02d:%0.02d" | format(nighthour, nightminute) }}
It is using only whole and half hours, but could easily be modified to use whatever fractions of an hour that you like. The nice thing about this slider is that it goes from before to beyond midnight using a decimal number between e.g. 21 to 27 and translates it into a correct time string from ‘21:00’ to ‘03:00’.
I find it useful. Hope somebody else does too.