How to format a card to show hours instead of seconds?

The groundwork is in place for this to be handled by the UI in the future. In 2022.4 (maybe 5), a new sensor device class duration was added. As long as a sensor has the following things set:

  • Has a value of hours, minutes, or seconds
  • Corresponding unit_of_measurement, h, m, or s
  • device_class: duration

The UI will display the value as d HH:MM:SS. Where d is days, HH is hours, MM is minutes and SS is seconds.

In the future, I could see a setting in the UI being added for the display on a duration sensor.

To add this functionality to the vacuum sensors, just manually customize the entity with

device_class: duration

Also, you should open an issue against the integration that’s creating those entities, as they should be setting the duration device class.

4 Likes