Skip to content

Commit

Permalink
πŸ› Correct conversion to int
Browse files Browse the repository at this point in the history
Better to round than truncate
  • Loading branch information
kamaradclimber committed Sep 21, 2024
1 parent 2a52f24 commit 50baa7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/aquarea/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def bit_to_bool(value: str) -> Optional[bool]:
def read_demandcontrol(value: str) -> Optional[int]:
i = float(value)
if i >= 43 and i <= 234:
return int((i - 43) / (234 - 43) * 100)
return round((i - 43) / (234 - 43) * 100)
return None


Expand Down

0 comments on commit 50baa7a

Please sign in to comment.