Skip to content

Commit

Permalink
feat: add temperature unit for aws devices
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlb committed Jan 12, 2025
1 parent e7ed2c1 commit 53f1181
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/blueair_api/device_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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}")
Expand Down
4 changes: 4 additions & 0 deletions tests/test_device_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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

0 comments on commit 53f1181

Please sign in to comment.