Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration-class badges do not respect unit of measurement #21967

Open
3 of 4 tasks
mateuszdrab opened this issue Sep 12, 2024 · 6 comments
Open
3 of 4 tasks

Duration-class badges do not respect unit of measurement #21967

mateuszdrab opened this issue Sep 12, 2024 · 6 comments

Comments

@mateuszdrab
Copy link

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • I have tried a different browser to see if it is related to my browser.
  • I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

Describe the issue you are experiencing

In 2024.8, a badge for a sensor with the configuration below displays '103 minutes'
image

Changing unit of measurement from min to millisecond reflects immediately on the card.

Describe the behavior you expected

In 2024.9, the preference for unit of measurement is ignored and the value displayed is '1:43:0'
Changing unit of measurement from min to millisecond does not reflect on the card.

Steps to reproduce the issue

Downgrade to 2024.8.

What version of Home Assistant Core has the issue?

core-2024.9.0

What was the last working version of Home Assistant Core?

core-2024.8.3

In which browser are you experiencing the issue with?

Edge

Which operating system are you using to run this browser?

Mac OS/Windows/Android

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

@karwosts
Copy link
Contributor

This is a side effect of removing #21755

We don't have a good solution for customizing duration formatting at this time.

@mateuszdrab
Copy link
Author

Thanks for clarifying.

It's strange because the actual state of the entity shows as minutes, I'd hope it would just show that.

Is the output of the states in Dev Tools is already formatted?

@karwosts
Copy link
Contributor

karwosts commented Sep 13, 2024

Developer-tools/states is always the raw state from the backend, that will be a number like 0.111.

In frontend device_class: duration sensors are in many places then reformatted as human readable HH:MM:SS format for display. It is the latter that generally there is no specific control for, and display_precision does not affect this.

@timdream
Copy link

This regression has caused Ping integration entities to display ping round trip time in seconds even though "unit of measurements" is set to "ms".

@karwosts karwosts changed the title Badges do not respect unit of measurement Duration-class badges do not respect unit of measurement Sep 20, 2024
@N3rdix
Copy link

N3rdix commented Sep 27, 2024

Just observed the same and makes some entities more or less unusable when using "d" as unit of measurement... Interesting enough that the configuration dialog respects the unit of measurement correctly (in my example 99).
Hopefully there can be a fix.

image

@mateuszdrab
Copy link
Author

Just observed the same and makes some entities more or less unusable when using "d" as unit of measurement... Interesting enough that the configuration dialog respects the unit of measurement correctly (in my example 99).
Hopefully there can be a fix.

image

Agreed, it's a strange experience since the units are now inconsistent in various locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants