Skip to content

Commit 50baa7a

Browse files
🐛 Correct conversion to int
Better to round than truncate
1 parent 2a52f24 commit 50baa7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

custom_components/aquarea/definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def bit_to_bool(value: str) -> Optional[bool]:
355355
def read_demandcontrol(value: str) -> Optional[int]:
356356
i = float(value)
357357
if i >= 43 and i <= 234:
358-
return int((i - 43) / (234 - 43) * 100)
358+
return round((i - 43) / (234 - 43) * 100)
359359
return None
360360

361361

0 commit comments

Comments
 (0)