From 5f10fcacad409bd3f37c2b1f1ce649b87b10d8dc Mon Sep 17 00:00:00 2001 From: Petr Kotek Date: Tue, 7 Jul 2020 00:08:03 +1000 Subject: [PATCH] =?UTF-8?q?AirPurifier=20MIoT:=20round=20temperature=20to?= =?UTF-8?q?=20one=20decimal=20point=20to=20return=20temperature=20"20.8=20?= =?UTF-8?q?=C2=B0C"=20instead=20of=20"20.799999=20=C2=B0C"=20(#753)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miio/airpurifier_miot.py | 2 +- miio/tests/test_airpurifier_miot.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/miio/airpurifier_miot.py b/miio/airpurifier_miot.py index f4027b595..3568f4d57 100644 --- a/miio/airpurifier_miot.py +++ b/miio/airpurifier_miot.py @@ -100,7 +100,7 @@ def humidity(self) -> int: def temperature(self) -> Optional[float]: """Current temperature, if available.""" if self.data["temperature"] is not None: - return self.data["temperature"] + return round(self.data["temperature"], 1) return None diff --git a/miio/tests/test_airpurifier_miot.py b/miio/tests/test_airpurifier_miot.py index dddd0e120..e05877d45 100644 --- a/miio/tests/test_airpurifier_miot.py +++ b/miio/tests/test_airpurifier_miot.py @@ -13,7 +13,7 @@ "aqi": 10, "average_aqi": 8, "humidity": 62, - "temperature": 18.6, + "temperature": 18.599999, "fan_level": 2, "mode": 0, "led": True, @@ -84,7 +84,7 @@ def test_status(self): assert status.aqi == _INITIAL_STATE["aqi"] assert status.average_aqi == _INITIAL_STATE["average_aqi"] assert status.humidity == _INITIAL_STATE["humidity"] - assert status.temperature == _INITIAL_STATE["temperature"] + assert status.temperature == 18.6 assert status.fan_level == _INITIAL_STATE["fan_level"] assert status.mode == OperationMode(_INITIAL_STATE["mode"]) assert status.led == _INITIAL_STATE["led"]