frontend
frontend copied to clipboard
History stats entity reports time value (e.g. 19:38) rather than duration value (0.33h) throughout UI
Checklist
- [X] I have updated to the latest available Home Assistant version.
- [X] I have cleared the cache of my browser.
- [X] I have tried a different browser to see if it is related to my browser.
Describe the issue you are experiencing
I have a number of history_stats sensors that record the time the thermostat is in various states (i.e. heating) that are showing incorrectly in the UI as a time rather than a duration. This worked correctly in 2022.4.7 releases and prior.
The graph itself shows the proper data within the graph (e.g. an increase to 0.33h over time which is consistent with the state of the ), but the entities card report shows a time value (19:38, not sure where this comes from).
This wrong "time" displayed value shows all over the UI (entity card, entities card, clicking to view entity to view the graph, etc) although the state of the sensor is correct.
Describe the behavior you expected
The sensor should be shown as a duration (e.g. 0.33h) as per previous versions of Home Assistant.
Steps to reproduce the issue
- Create history_stats sensor.
- platform: history_stats name: House Thermostat Today Heating Time entity_id: sensor.house_thermostat_hvac_action state: 'heating' type: time start: '{{ now().replace(hour=0, minute=0, second=0) }}' end: '{{ now() }}'
- Add entity card with this entity to the UI.
- Note it shows a time value (e.g. "0") rather than a duration (e.g. "0h") as in past releases.
What version of Home Assistant Core has the issue?
2022.5.2
What was the last working version of Home Assistant Core?
2022.4.7
In which browser are you experiencing the issue with?
Microsoft Edge 101.0.1210.32 (also, Safari iOS as found in iOS 15.4.1)
Which operating system are you using to run this browser?
Windows 10 Home 19044.1645, iOS Safari (as of iOS 15.4.1)
State of relevant entities
sensor.house_thermostat_today_heating_time
House Thermostat Today Heating Time
0.33 state_class: measurement
unit_of_measurement: h
device_class: duration
icon: mdi:chart-line
friendly_name: House Thermostat Today Heating Time
Problem-relevant frontend configuration
type: entities
entities:
- entity: sensor.house_thermostat_today_heating_time
Javascript errors shown in your browser console/inspector
No response
Additional information
Obviously I'm dense (0.33h ~= 19.8m). With that being said, I use 24h time and this sensor (at this time of year) is typically under 20mins this time of year so I understand why I was confused (19:48 being a valid time). The old notation (0.33h) made it VERY clear it was a duration. 19m48s would be far better. If it is planned on staying this way, I'll use a template sensor to format it away from this notation as it's too easily interpreted (for hours less than "24:00" at least) as a time.
It seems better to me if the visualization included the hours independent if zero, in which case it would be 00:19:38.
I agree it would be an improvement over the current implementation, but I still have concerns regarding differentiating a time and a duration from an end user's perspective. "00:19:38" could still be read as a valid 24h time.
I realize there is probably localization considerations, but something like 0h0m0s would make it far more clear that it is a duration rather than a time (and could be scaled to include days/years/etc).
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.