Minutes and hours sensor

Hello
I came up with the idea of making an HTC graphic clock.
I wanted to use the conditional function to display HTC clock digits at the right time.
And here for now I haven’t found a solution how to create 4 sensors: tens of hours, hours, tens of minutes and minutes.
Can anyone have an idea how to make these sensors.
best regards

This is already available if you want the look without the hassle of working it out HTC Flip Clock with weather . Sorry I can’t help you with the actual answer to your question if you want to make the clock yourself!

Did you look at the date & time sensors?

The idea is to underlay a graphic file for each digit of the clock, which is why I need 4 sensors.
I was on these pages.

Make sure you have sensor.time set up in your config (reference). That will give you e.g. 12:34. Then use four template sensors:

- platform: template                                                            
  sensors:                                                                      
    tens_of_hours:                                                 
      value_template: '{{ states("sensor.time")[0] }}'
    hours:                                                 
      value_template: '{{ states("sensor.time")[1] }}'
    tens_of_minutes:                                                
      value_template: '{{ states("sensor.time")[3] }}'
    minutes:                                                 
      value_template: '{{ states("sensor.time")[4] }}'
1 Like

Thank you, Works

I put the following in configuration.yaml and it was invalid. Why?

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'

- platform: template
  sensors:
    hours:                                                 
      value_template: '{{ states("sensor.time")[1] }}'
    minutes:                                                 
      value_template: '{{ states("sensor.time")[4] }}'``

Thanks; I’ve installed the HA extension to visual code to help with programming YAML.