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

Configurable number of decimal places for precip_accumulation entities #192

Open
3 tasks done
DeltaNu1142 opened this issue Feb 12, 2024 · 14 comments
Open
3 tasks done
Labels

Comments

@DeltaNu1142
Copy link

Describe the feature

There is currently a feature to round values to the nearest integer. More precision is preferable, but the entity values for my precip_accum* sensors are currently delivered out to 11 decimal places. This is far too many, and none of the weather cards I'm using will truncate or round those values to x.x or x.xx.

Home Assistant version

2024.2.1

Integration version

1.4.3

Acknowledgements

  • I have searched this repository and API Repository to see if the feature has already been requested.
  • This featre request is sepecific to the HA Integration.
  • I have written an informative title.
@DeltaNu1142 DeltaNu1142 added enhancement New feature or request Needs Review labels Feb 12, 2024
@cloneofghosts
Copy link
Collaborator

In the 1.4.2 release I added suggested_display_precision to all the sensors and for the precipitation accumulation sensor I set it to only have 4 decimal places. When I look at the sensor in my HA I see the following:

When you look at the sensor in your HA install is it rounded to 4 decimal places or does it show all 11 decimal places? Starting in 2023.3 you are able to change the display precision for each sensor individually which should solve your issue here.

@DeltaNu1142
Copy link
Author

DeltaNu1142 commented Feb 12, 2024 via email

@cloneofghosts
Copy link
Collaborator

The images you included didn't attach to your post.

@DeltaNu1142
Copy link
Author

DeltaNu1142 commented Feb 12, 2024 via email

@cloneofghosts
Copy link
Collaborator

That link worked thanks. As far as I can tell that option doesn't actually change the value of the sensors which is why the 2nd and 3rd screenshots still show the sensor with 11 decimal places.

What is the weather card you are using in your third screenshot? It's possible that it hasn't been updated to take advantage of the option to change the display precision in HA.

@DeltaNu1142
Copy link
Author

DeltaNu1142 commented Feb 12, 2024 via email

@cloneofghosts
Copy link
Collaborator

That weather card hasn't been updated since December 2022 which is before the precision attribute was added to HA.

There was code before which should have rounded the sensors to specific number of decimals but it didn't seem to work but maybe it could be looked into and see if it could start working, There's also another issue where the integration is always using scientific units and then they get converted into local units. I remember seeing that it used to not always be that way but it was causing some issues.

Either way I'll ping @alexander0042 to see what the options for this are.

@DeltaNu1142
Copy link
Author

DeltaNu1142 commented Feb 12, 2024 via email

@cloneofghosts
Copy link
Collaborator

cloneofghosts commented Feb 14, 2024

I've released a 1.4.4 beta version which should hopefully fix the issue with the ridiculous number of decimal places you're seeing with the sensors. It's not configurable at the moment but it's setup so that if rounding is enabled the precipitation related sensors show two decimal places and all other sensors have no decimal places.

Let me know if this fixes the issue for you and maybe @alexander0042 could set something up for the next big release after V2 of the API has been released.

@DeltaNu1142
Copy link
Author

DeltaNu1142 commented Feb 14, 2024 via email

@cloneofghosts
Copy link
Collaborator

Do you have rounding enabled or disabled? If it's enabled it should be showing 2 decimal places instead of 4. If it's not showing 2 decimal places I'll have to debug to see what's going on.

@DeltaNu1142
Copy link
Author

DeltaNu1142 commented Feb 14, 2024 via email

@cloneofghosts
Copy link
Collaborator

Good to know that it's working for you. I created a PR to merge this in so hopefully it can be reviewed so it can be merged in soon.

If I knew more about HA I could take a stab at trying to make it configurable but alas I don't nor do I have a dev machine setup for this sort of stuff. @alexander0042 is the one who created the integration and knows more about this sort of stuff so I'll leave it to him to set this up. I can do smaller-scale changes which I've done before to fix other issues that have cropped up.

@cloneofghosts
Copy link
Collaborator

Haven't forgotten about this! I finally got a devcontainer setup and working so I should be able to take a stab at this soon (if nobody else beats me to it).

I was thinking along the lines of having two sliders - one for the data points which are rounded to 2 decimal points and one for the ones which are rounded to 4 decimal points or do you have a different suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

3 participants