From 50baa7ae4b977c4592e2a5e13b96f390ff1b0302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Sat, 21 Sep 2024 18:39:29 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Correct=20conversion=20to=20int?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Better to round than truncate --- custom_components/aquarea/definitions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/aquarea/definitions.py b/custom_components/aquarea/definitions.py index 9ad236d..d7abd06 100644 --- a/custom_components/aquarea/definitions.py +++ b/custom_components/aquarea/definitions.py @@ -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