Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add tests for protect 7470i #34

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading