From 53f1181fd544371ac36d87ece55e82aaa5d2c68c Mon Sep 17 00:00:00 2001 From: Bren Dahl Date: Sun, 12 Jan 2025 15:22:10 -0500 Subject: [PATCH] feat: add temperature unit for aws devices --- src/blueair_api/device_aws.py | 2 ++ tests/test_device_aws.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/blueair_api/device_aws.py b/src/blueair_api/device_aws.py index 5b0f3f0..97cc55b 100644 --- a/src/blueair_api/device_aws.py +++ b/src/blueair_api/device_aws.py @@ -74,6 +74,7 @@ async def create_device(cls, api, uuid, name, mac, type_name, refresh=False): cool_fan_speed: AttributeType[int] = None # api value 11/37/64/91 ap_sub_mode: AttributeType[int] = None # api value 1 manual speeed, 2 auto fan speed fan_speed_0: AttributeType[int] = None # api value 11/37/64/91 + temperature_unit: AttributeType[int] = None # api value of 1 is celcius async def refresh(self): _LOGGER.debug(f"refreshing blueair device aws: {self}") @@ -140,6 +141,7 @@ def states_safe_get(key): self.cool_fan_speed = states_safe_get("coolfs") self.ap_sub_mode = states_safe_get("apsubmode") self.fan_speed_0 = states_safe_get("fsp0") + self.temperature_unit = states_safe_get("tu") self.publish_updates() _LOGGER.debug(f"refreshed blueair device aws: {self}") diff --git a/tests/test_device_aws.py b/tests/test_device_aws.py index 414f2a7..d0f8209 100644 --- a/tests/test_device_aws.py +++ b/tests/test_device_aws.py @@ -384,6 +384,7 @@ async def test_attributes(self): assert device.cool_sub_mode is NotImplemented assert device.cool_fan_speed is NotImplemented assert device.fan_speed_0 is NotImplemented + assert device.temperature_unit is NotImplemented class H35iTest(DeviceAwsTestBase): @@ -437,6 +438,7 @@ async def test_attributes(self): assert device.cool_sub_mode is NotImplemented assert device.cool_fan_speed is NotImplemented assert device.fan_speed_0 is NotImplemented + assert device.temperature_unit is NotImplemented class T10iTest(DeviceAwsTestBase): """Tests for T10i.""" @@ -489,6 +491,7 @@ async def test_attributes(self): assert device.cool_fan_speed == 11 assert device.ap_sub_mode == 1 assert device.fan_speed_0 == 11 + assert device.temperature_unit == 1 class Protect7470iTest(DeviceAwsTestBase): @@ -542,3 +545,4 @@ async def test_attributes(self): assert device.cool_fan_speed is NotImplemented assert device.ap_sub_mode is NotImplemented assert device.fan_speed_0 is NotImplemented + assert device.temperature_unit is NotImplemented