-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Helpers rework - rounding #1529
Conversation
…dled in helpers now)
Tested on Demo-Instance, would ask you for some feedback @RubenKelevra or @KartoffelToby |
@folfy Thanks! <3 |
@KartoffelToby Sure, but you're talking about real linting or just formattting, because I just see black in the config, which would be a formatter? Have to figure out if/how I could get it running on my PRs, probably I don't have permission if it's not started automatically and will have to get and run it locally then or set it up on my repo. |
@folfy you should have the permissions, as i added you to the Contributors anyway. I setup a pre commit hook in the repo (you need to have installed it on your maschine) https://pre-commit.com/ Or if you have docker, you can run: |
@KartoffelToby Ohhh, those options both looks nice and as straight-forward as l like it to be, great! Ofc also running all my stuff in docker, thanks a lot ❤️ |
Motivation:
A lot of code is unused and redundant, so cleaned this up before fixing #1475. I know a lot of these conversions back and forth were done to avoid the rounding error from floating point arithmetic, but I'm proposing easier ways to achieve this.
The 0.0001 offset for correcting this error is a bit of a hack as well, but I think it's the simplest solution, given that we do not need arbitrary precision or working with extremly large numbers.
Changes:
Related issue (check one):
Checklist (check one):
Test-Hardware list (for code changes)
HA Version: 2024.12.1
Zigbee2MQTT Version: N/A (ZHA)
TRV Hardware: Demo and HmIP