As far as I know, no.
But I think it would be a good change in the integration.
Who would want it in seconds?
Minutes is perhaps more useful but still, hours is probably the most useful here.
I think the integration is fine and changing it would even affect long term storage of data, it’s the dashboard that should allow reformatting numbers.
I’ve run into this, too. Just recently in 2022.5 something changed and now some of my dashboard displays which were in decimal hours are in HH:MM:SS format. That’s OK, but I don’t need the seconds to display. It only makes the screen look cluttered.
In hopes of avoiding the flood of responses I know would come, let me be clear: I know I can create a template in whatever format I want. I’ve got dozens of templates already. I don’t think it’s a good practice to create templates (data) simply to display a value. The display should be separate from the data.
This isn’t the first time this has come up. A quick search came up with this question, and a few Feature Requests. I suggest up-voting any you agree with:
There are no doubt more discussions on this; I just did a very quick search.
I agree. Creating templates to format a value is like cracking walnuts with a sledgehammer.
There was an issue raised when the Xiaomi vacuum changed from hours to seconds. The devs indicated that as a policy they no longer change the units reported by the device and it would not be changed. So we are probably going to see more of this sort of thing.
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.
I have everything set up as mentioned here. All I need is to be able to tell the UI to display HH:MM and not HH:MM:SS. I’d love to avoid the extra template sensor.
Is there a FR for this somewhere that I might’ve missed?
IIRC duration sensors already do this. I’m not sure if you can select a display. Timestamp sensors only show relative time. A nice FR would be to give these 2 sensor types “Unit conversion” options to change them into a specific format.
I wonder - does “uom” have any impact on a sensor with the “duration” device_class?
Cannot check it myself right now, just curious.
For instance , if a value “1” has “uom: hour” - will it be displayed as “01:00:00”?
Or, if a value “1000” has “uom: ms” - will it be displayed as “00:00:01”?
Regarding accuracy.
The displayed value is “01:51:31”. You may convert it to hours - and you will get “1,858611111111111”.
If I default value is “1.86”, it should be displayed as “01:51:36”.
Yup, I get that. But I think for dates and times precision should be handled differently. The precision UI was specifically added for presentation purposes. In this case the internal representation looks entirely different, so it doesn’t quite work.
Looks good, there is no Show As on the entity, so different display options are probably not implemented. You’ll probably need to create a template sensor unfortunately.