home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.84k stars 2.62k forks source link

inconsistent rendering for entities of device_class: duration #21346

Open unclehack opened 3 weeks ago

unclehack commented 3 weeks ago

Checklist

Describe the issue you are experiencing

I was trying to add an entity to my dashboard. The entity had device_class: duration and unit_of_measurement: s. I've tried to put this in a card stack as an entity card. It was showing as a value in seconds instead. This was surprising since the more-info card from the device's page and the entity's details was displaying this as hh:mm:ss.

The entities, tile, glance and more-info cards do show it as hh:mm:ss. Other cards don't appear to do that.

I thought that this was something which could be controlled from the entity's settings. The unit and the precision don't do much to help. Choosing hours would show the value in hours with a comma, not hh:mm:ss.

Describe the behavior you expected

The behavior should be the same across the cards. It might also be helpful to have the means to choose how these values are formatted.

Steps to reproduce the issue

  1. find an entity with device_class: duration & and unit_of_measurement: s
  2. try to add it to the various types of cards
  3. figure out which cards show it as hh:mm:ss and which ones display it as a value in seconds ...

What version of Home Assistant Core has the issue?

2024.7.1

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox

Which operating system are you using to run this browser?

No response

State of relevant entities

state_class: total_increasing
unit_of_measurement: s
device_class: duration
icon: mdi:timer-outline
friendly_name: Uptime Sensor

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

ildar170975 commented 3 weeks ago

Not tested a lot, but here are some obvious differences:

image

Starring: Entities, Glance, Entity, Sensor, History graph