-
Notifications
You must be signed in to change notification settings - Fork 79
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 round instead of int #371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for the quickfix! 🚀 Just a small comment and we good to merge
@@ -342,7 +342,7 @@ async def update_alarm_volume( | |||
if JSON_ALARM_VOLUME in response: | |||
if polling: | |||
volume_raw = str(response[JSON_ALARM_VOLUME]) | |||
volume_int = int(float(volume_raw) * 100) | |||
volume_int = round(float(volume_raw) * 100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure i understand what you mean, round()
returns an integer if number of digits are not defined.
>>> round(2.555)
3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, what de heck 😄 please just disregard my comment, @DurgNomis-drol, @KapJI
sorry, i got quick reference from here and used the python instance that I had by hand... and guess where the magic is... we still use python 2.7 at work 🤦
haha, you're absolutely right, in python 3 it's integer:
Sorry my fault 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, apart from the misunderstanding i had, it's perf 🚀 thanks for implementing it
@leikoilja Haha 😆 No problem |
Fixes #359 (comment)
Should we also round the float to less decimals?