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

Sensor precision not respected #286

Open
Wesley-Vos opened this issue Mar 2, 2023 · 15 comments · May be fixed by #336
Open

Sensor precision not respected #286

Wesley-Vos opened this issue Mar 2, 2023 · 15 comments · May be fixed by #336
Labels
enhancement New feature or request

Comments

@Wesley-Vos
Copy link

Wesley-Vos commented Mar 2, 2023

The new sensor precision introduced in 2023.3.0 is not respected. The full sensor value is shown instead of the rounded value.

You can reproduce it by adding a multiple-entity-row with a numeric sensor entity. In the more-info dialog of the sensor, change the precision to something non-default and observe that the full state is still shown in the multiple-entity-row.

For more information, see https://developers.home-assistant.io/blog/2023/02/08/sensor_presentation_rounding/

Edit: in the meantime, it can be fixed by adding format:precision<0-9> but in my opinion, the default precision should be used, just as it was before < 2023.3.0.

@TheQue42
Copy link

TheQue42 commented Mar 2, 2023

@Wesley-Vos : Trying to understand your Edit.... (since I dont have a clue how these js-plugins are coded) have you got a workaround for the issue?
(I am a bit worried that this repo isnt that active?)
Edit: Nevermind, I finally RTFM:ed properly.

@Wesley-Vos
Copy link
Author

Wesley-Vos commented Mar 2, 2023

@TheQue42 You have to add it to your card configuration in HA, not in the plug-in itself luckily.

For example, check out this card configuration:

type: entities
entities:
  - entity: sensor.util_energy_daily
    name: Usage today
    secondary_info: last-updated
    show_state: false
    type: custom:multiple-entity-row
    entities:
      - entity: sensor.util_energy_daily_low
        name: Low
        format: precision2
      - entity: sensor.util_energy_daily_high
        name: High
        format: precision2
      - entity: sensor.util_energy_daily
        name: Total
        format: precision2

The format: precision2 is the additional option I meant. This will do the rounding for now, until it is fixed.

@ildar170975
Copy link

I do not think that the card should use recently added precisions.
imho currently available “format” option is rather sufficient.

@sargue
Copy link

sargue commented Mar 3, 2023

Perhaps in absence of any "format" option it should honor the new defined precision for the entity. We get best of both worlds: support for consistency with the new HA feature while still having the option to go with any custom format/precision.

@Wesley-Vos
Copy link
Author

Perhaps in absence of any "format" option it should honor the new defined precision for the entity. We get best of both worlds: support for consistency with the new HA feature while still having the option to go with any custom format/precision.

Yeah I agree! That is the best of both worlds, and is in line with the other built-in HA cards as well.

@ildar170975
Copy link

ildar170975 commented Mar 3, 2023

Well, it probably will be a perfect variant.
Hope one day this functionality will be added.
But as I said - not critical for me.

@antgustech
Copy link

Thanks, adding
format: precision2

Seems to work. However the docs also say we should be able to use format: number X but that does not work.

@ildar170975
Copy link

the docs also say we should be able to use format: number X but that does not work.

Where?
изображение

@antgustech
Copy link

the docs also say we should be able to use format: number X but that does not work.

Where? изображение

Never mind, read the type. 🤦‍♂️

@ildar170975
Copy link

ildar170975 commented Jun 11, 2023

Type of what? Consider explaining yourself, otherwise you are saying riddles.
Here "type=number" means that some formats are applied to numbers only.
Your needed format is precisionX as was said.

@antgustech
Copy link

Type of what? Consider explaining yourself, otherwise you are saying riddles.

I meant the type column in the docs. I misread it as the actual syntax.

@ildar170975
Copy link

No no, It is just an additional explanation: some formatters may be used for numbers, some for datetime.

@bcutter
Copy link

bcutter commented Aug 28, 2023

Progress? Or is everyone happy with the applied format: precisionX (and spent already approx. 2 hours to fix everything in all views like me 😞)?

@mill1000
Copy link
Contributor

mill1000 commented Sep 7, 2023

Just noticed that the latest HA release has added new methods to allow entity state formatting for custom cards.
https://developers.home-assistant.io/blog/2023/08/29/hass-format-state

@darrenfreeman
Copy link

Almost all of my sensors use a non-default precision, so this issue requires a lot of extra YAML, just to make the multiple entity row behave like the rest of the entity card.

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

Successfully merging a pull request may close this issue.

9 participants