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

Use Entity-state-formatting #42

Open
Olen opened this issue Aug 31, 2023 · 2 comments
Open

Use Entity-state-formatting #42

Olen opened this issue Aug 31, 2023 · 2 comments

Comments

@Olen
Copy link
Owner

Olen commented Aug 31, 2023

Replace hard coded labels and units of measurement with https://developers.home-assistant.io/docs/frontend/data#entity-state-formatting

This allows us to simplify the WS data and ensures consistent values.

@Olen
Copy link
Owner Author

Olen commented Aug 31, 2023

Should be able to do something like

      var displayVal = hass.formatEntityState(hass.states[sensor[attr]]);

Around line 305.
But as we hide the unit on small screens, we would need to split the unit from the number and do some various validations anyway, so maybe this is not really feasible. After all, the WS sends the info from the sensor, so it should be correct.
Although #39 could possibly be fixed by this?
Are there other ways to get precision for a sensor from the hass-object?

@Olen
Copy link
Owner Author

Olen commented Apr 5, 2024

Partial fix in the latest beta. Precision is now fetched gtom formatEntityState, but unit is still fetched from the WS-request.

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

1 participant