Skip to content

Commit

Permalink
fix: change tf atrribute to be optional due to voc data, chore: add t…
Browse files Browse the repository at this point in the history
…ests for protect 7470i
  • Loading branch information
dahlb authored Dec 15, 2024
1 parent cacfed9 commit ba28a06
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/blueair_api/intermediate_representation_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class Sensor:
e: bool # ???
fe: bool # ??? always True.
ot: str # object type / topic name
tf: str # senml+json; topic format
tn: str # topic name a path-like name d/????/s/{n}
ttl: int # only seen 0 or -1, not sure if used.
tf: str | None = None # senml+json; topic format

@dataclasses.dataclass
class Control:
Expand Down
46 changes: 46 additions & 0 deletions tests/test_device_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,49 @@ async def test_attributes(self):
assert device.auto_regulated_humidity is NotImplemented
assert device.water_shortage is NotImplemented
assert device.wick_dry_mode is NotImplemented


class Protect7470iTest(DeviceAwsTestBase):
"""Tests for protect7470i."""

def setUp(self):
super().setUp()
with open(resources.files().joinpath('device_info/protect_7470i.json')) as sample_file:
info = json.load(sample_file)
self.device_info_helper.info.update(info)

async def test_attributes(self):

await self.device.refresh()
self.api.device_info.assert_awaited_with("fake-name-api", "fake-uuid")

with assert_fully_checked(self.device) as device:

assert device.model == ModelEnum.PROTECT_7470I

assert device.pm1 == 0
assert device.pm2_5 == 0
assert device.pm10 == 0
assert device.tVOC == 59
assert device.temperature == 23
assert device.humidity == 46
assert device.name == "air filter in room"
assert device.firmware == "2.1.1"
assert device.mcu_firmware == "1.0.12"
assert device.serial_number == "110582600000110110016855"
assert device.sku == "105826"

assert device.running is True
assert device.standby is False
assert device.night_mode is False
assert device.germ_shield is True
assert device.brightness == 100
assert device.child_lock is True
assert device.fan_speed == 91
assert device.fan_auto_mode is False
assert device.filter_usage_percentage == 50
assert device.wifi_working is True
assert device.wick_usage_percentage is NotImplemented
assert device.auto_regulated_humidity is NotImplemented
assert device.water_shortage is NotImplemented
assert device.wick_dry_mode is NotImplemented

0 comments on commit ba28a06

Please sign in to comment.