Format time duration readably #309
Unanswered
mariusz-schimke
asked this question in
Other UI enhancements
Replies: 2 comments 1 reply
-
|
My expectation is that durations should be formatted the same way that timestamps are by default. By all means keep the manual configuration for use cases where having a fixed scale makes sense, but those use cases should also let the integration hint at the suitable UI unit of measurement, and the naming needs to be distinct from the unit_of_measurement of the underlying sensor, as the current reuse of naming is causing confusion. |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
It looks related to: home-assistant/frontend#23338 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the enhancement
I have several sensors that report duration—usually in seconds—such as this one from ESPHome tracking gas consumption time. The values can range from just a few seconds up to several hours. Other sensors I use span durations from seconds to days or even years. Let me give you an example entity with the
device_classofduration:Now let me change its unit to seconds for comparison:
When the unit is left as seconds, it becomes hard to interpret larger values—you’re forced to do mental math to understand them. On the other hand, if you switch the unit to hours, you lose the ability to see shorter durations accurately, like seconds, which might still be important.
What I’d expect instead:
I believe the UI should automatically format values based on their size. For example:
Why unit switching in the entity's settings is not a workaround (even though I mentioned it):
Changing the unit (e.g., from seconds to minutes) breaks compatibility with other parts of the system. For example:
It would be great if Home Assistant could handle formatting duration values in a universal, human-readable way on the UI level, without requiring changes to the underlying unit or sensor logic.
Use cases
I have multiple duration sensors, including utility meters, whose values span from seconds to hundreds of days.
Visual examples
No response
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions