Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dsh0416 committed Jun 16, 2024
1 parent c5f04a0 commit 4d2310e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
4 changes: 3 additions & 1 deletion miio/integrations/zhimi/airpurifier/airpurifier_miot.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,10 @@ def status(self) -> AirPurifierMiotStatus:

return AirPurifierMiotStatus(
{
# max_properties limited to 10 to avoid "user ack timeout"
# messages from some of the devices. (e.g. xiaomi.airp.va2b)
prop["did"]: prop["value"] if prop["code"] == 0 else None
for prop in self.get_properties_for_mapping()
for prop in self.get_properties_for_mapping(max_properties=10)
},
self.model,
)
Expand Down
30 changes: 15 additions & 15 deletions miio/integrations/zhimi/airpurifier/tests/test_airpurifier_miot.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,30 +411,30 @@ def airpurifierVA2B(request):
class TestAirPurifierVA2B(TestCase):
def test_status(self):
status = self.device.status()
assert status.is_on is _INITIAL_STATE_VA2["power"]
assert status.anion == _INITIAL_STATE_VA2["anion"]
assert status.aqi == _INITIAL_STATE_VA2["aqi"]
assert status.humidity == _INITIAL_STATE_VA2["humidity"]
assert status.is_on is _INITIAL_STATE_VA2B["power"]
assert status.anion == _INITIAL_STATE_VA2B["anion"]
assert status.aqi == _INITIAL_STATE_VA2B["aqi"]
assert status.humidity == _INITIAL_STATE_VA2B["humidity"]
assert status.temperature == 18.6
assert status.fan_level == _INITIAL_STATE_VA2["fan_level"]
assert status.mode == OperationMode(_INITIAL_STATE_VA2["mode"])
assert status.fan_level == _INITIAL_STATE_VA2B["fan_level"]
assert status.mode == OperationMode(_INITIAL_STATE_VA2B["mode"])
assert status.led is None
assert status.led_brightness == LedBrightness(
_INITIAL_STATE_VA2["led_brightness"]
_INITIAL_STATE_VA2B["led_brightness"]
)
assert status.buzzer == _INITIAL_STATE_VA2["buzzer"]
assert status.child_lock == _INITIAL_STATE_VA2["child_lock"]
assert status.favorite_level == _INITIAL_STATE_VA2["favorite_level"]
assert status.buzzer == _INITIAL_STATE_VA2B["buzzer"]
assert status.child_lock == _INITIAL_STATE_VA2B["child_lock"]
assert status.favorite_level == _INITIAL_STATE_VA2B["favorite_level"]
assert (
status.filter_life_remaining == _INITIAL_STATE_VA2["filter_life_remaining"]
status.filter_life_remaining == _INITIAL_STATE_VA2B["filter_life_remaining"]
)
assert status.filter_hours_used == _INITIAL_STATE_VA2["filter_hours_used"]
assert status.filter_left_time == _INITIAL_STATE_VA2["filter_left_time"]
assert status.filter_hours_used == _INITIAL_STATE_VA2B["filter_hours_used"]
assert status.filter_left_time == _INITIAL_STATE_VA2B["filter_left_time"]
assert status.use_time is None
assert status.motor_speed == _INITIAL_STATE_VA2["motor_speed"]
assert status.motor_speed == _INITIAL_STATE_VA2B["motor_speed"]
assert (
status.filter_rfid_product_id
== _INITIAL_STATE_VA2["filter_rfid_product_id"]
== _INITIAL_STATE_VA2B["filter_rfid_product_id"]
)
assert status.filter_type == FilterType.AntiBacterial

Expand Down

0 comments on commit 4d2310e

Please sign in to comment.