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

Times on entities and tile card displayed incorrect #21984

Open
4 tasks done
dhoeben opened this issue Sep 15, 2024 · 4 comments
Open
4 tasks done

Times on entities and tile card displayed incorrect #21984

dhoeben opened this issue Sep 15, 2024 · 4 comments

Comments

@dhoeben
Copy link
Contributor

dhoeben commented Sep 15, 2024

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

-- This is a duplicate from: home-assistant/core#125830 (comment), which is been moved to here.

When using time entity (e.g. Waze) in a Tile card or entities card, it shows the time with seconds. This results in times shown with :00 at the end as this is always zero. See screenshot. Also in entity config, rounding is set to display without value behind comma (30 iso 30,x). Unit is also not showing.

Screenshot_20240912-155340

Describe the behavior you expected

To display correct time in minutes or hours without seconds and with units.

Steps to reproduce the issue

Create a tile card
Use entity which shows time (e.g. Waze)
Experience behaviour

What version of Home Assistant Core has the issue?

core-2024.9.1

What was the last working version of Home Assistant Core?

core_2024.8.x

In which browser are you experiencing the issue with?

All

Which operating system are you using to run this browser?

iOS, ChromeOS, macOS, Windows, Linux, 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 how frontend formats all entities with device_class: duration. It would be nice to find some way to control this behavior, but I haven't figured out a good solution. The recent change you notice is due to #21755

@dhoeben
Copy link
Contributor Author

dhoeben commented Sep 20, 2024

This is how frontend formats all entities with device_class: duration. It would be nice to find some way to control this behavior, but I haven't figured out a good solution. The recent change you notice is due to #21755

Maybe when using sensors with device_class: duration, i.s.o. showing the decimal rounding, show different time formats which can be used to display? I'd love to help of you point me to the right file!

@karwosts
Copy link
Contributor

karwosts commented Sep 20, 2024

I've thought about that some times, but it has some complications.

  • Suggested display precision is an integer value from 0 to 10, and in the backend integrations already set a suggested_display_precision for these entities, so we would have to map this integer to arbitrary formats which would be difficult to communicate with backend.

  • A few places in frontend still don't use the duration formatting and just show the raw state value (like I think Entity card and maybe when plotting on a graph), but those do still use the display_precision, so you'll have to pick a single value for display precision which is both a number of decimals in some places and an arbitrary format in another.

  • If someone doesn't want to use hhmmss formatting, then they won't be able to set the display_precision of the resulting decimal, because we've overloaded that field for something else. So how do we choose how many digits to display on this value? Unless we save like half the entries for duration formatting and the other half for decimals? Maybe could work.

And then on top of all that, I don't know if it would be approved to overload this field in such a way.

@dhoeben
Copy link
Contributor Author

dhoeben commented Sep 20, 2024

I've thought about that some times, but it has some complications.

  • Suggested display precision is an integer value from 0 to 10, and in the backend integrations already set a suggested_display_precision for these entities, so we would have to map this integer to arbitrary formats which would be difficult to communicate with backend.

  • A few places in frontend still don't use the duration formatting and just show the raw state value (like I think Entity card and maybe when plotting on a graph), but those do still use the display_precision, so you'll have to pick a single value for display precision which is both a number of decimals in some places and an arbitrary format in another.

  • If someone doesn't want to use hhmmss formatting, then they won't be able to set the display_precision of the resulting decimal, because we've overloaded that field for something else. So how do we choose how many digits to display on this value? Unless we save like half the entries for duration formatting and the other half for decimals? Maybe could work.

And then on top of all that, I don't know if it would be approved to overload this field in such a way.

Thanks for the reply. I understand the difficulties now.

I'll look into your second bullit, for streamlining this should be fixed anyway.

For the last bullit, I was thinking more like an input field, which follows Pythons standard time formatting (or Jinja2) with a default value of hh:mm:ss. This way, it is probably easier for backend to handle, as they can just translate it back to miliseconds (I believe they use) and not a lot of if and else's.

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

2 participants