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

Volume is not a percentage #359

Closed
TheFes opened this issue Oct 8, 2021 · 6 comments · Fixed by #365 or #371
Closed

Volume is not a percentage #359

TheFes opened this issue Oct 8, 2021 · 6 comments · Fixed by #365 or #371
Labels
bug Something isn't working

Comments

@TheFes
Copy link

TheFes commented Oct 8, 2021

Describe the bug

the new number entity shows it's value with unit_of_measure %, but it not a percentage, as 1 is the maximum value. (this should be 100% if it was indeed a percentage)

Version of the integration

If you are unsure about the version check the github release here.

1.82.2

Logs

none relevant
@leikoilja
Copy link
Owner

Fair point, thanks for reporting @TheFes.
Noticed that the other day and didn't want to change it yet cause it will become a breaking change for some who already have automations tuned to use these values. But we need to fix that and release a minor version with breaking change notes 🙃 will mark it as a bug so we can more it further

@leikoilja leikoilja added the bug Something isn't working label Oct 10, 2021
@TheFes
Copy link
Author

TheFes commented Oct 10, 2021

You could also just remove the unit_of_measure.

DurgNomis-drol added a commit to DurgNomis-drol/ha-google-home that referenced this issue Oct 15, 2021
@leikoilja
Copy link
Owner

@TheFes the fix is going out live with the next release tonight. Please check it out and let us know if things are not working as expected 🚀

@nattofriends
Copy link

Google Home devices seem to have floating point issues, which mean that combined with https://github.com/leikoilja/ha-google-home/blob/master/custom_components/google_home/api.py#L345, the percentages returned for volume keep getting rounded down.

For example, I receive these these raw volume levels:

2021-10-20 02:49:00 DEBUG (MainThread) [custom_components.google_home] Received alarm volume from Google Home device (my device) - Volume: 64(raw=0.6499999761581421)
2021-10-20 02:49:00 DEBUG (MainThread) [custom_components.google_home] Received alarm volume from Google Home device (my device) - Volume: 69(raw=0.699999988079071)
2021-10-20 02:49:00 DEBUG (MainThread) [custom_components.google_home] Received alarm volume from Google Home device (my device) - Volume: 72(raw=0.7200000286102295)

and they should probably be 65, 70, and 72.

This should be easy enough to solve by using round() instead of int()

@leikoilja
Copy link
Owner

haha, fair point, @nattofriends. We should probably do that instead, thanks for reporting it, should be a small fix :)
@nattofriends can you please open a new issue so we pick it up 🚀

@leikoilja
Copy link
Owner

Kudos to @DurgNomis-drol for the nice quick fix in #371 💥
Will go out with the next release 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants