-
-
Notifications
You must be signed in to change notification settings - Fork 574
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
Air Purifier: Property "button_pressed" added #253
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,6 +251,16 @@ def auto_detect(self) -> Optional[bool]: | |
|
||
return None | ||
|
||
@property | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redefinition of unused 'use_time' from line 176 |
||
def use_time(self) -> Optional[int]: | ||
"""How long the device has been active in seconds.""" | ||
return self.data["use_time"] | ||
|
||
@property | ||
def button_pressed(self) -> Optional[str]: | ||
"""Last pressed button.""" | ||
return self.data["button_pressed"] | ||
|
||
@classmethod | ||
def _get_filter_type(cls, product_id: str) -> FilterType: | ||
ft = cls._filter_type_cache.get(product_id, None) | ||
|
@@ -290,7 +300,9 @@ def __repr__(self) -> str: | |
"sleep_mode_learn_count=%s, " \ | ||
"extra_features=%s, " \ | ||
"turbo_mode_supported=%s, " \ | ||
"auto_detect=%s>" % \ | ||
"auto_detect=%s, " % \ | ||
"use_time=%s, " % \ | ||
"button_pressed=%s>" % \ | ||
(self.power, | ||
self.aqi, | ||
self.average_aqi, | ||
|
@@ -319,7 +331,9 @@ def __repr__(self) -> str: | |
self.sleep_mode_learn_count, | ||
self.extra_features, | ||
self.turbo_mode_supported, | ||
self.auto_detect) | ||
self.auto_detect, | ||
self.use_time, | ||
self.button_pressed) | ||
return s | ||
|
||
|
||
|
@@ -336,7 +350,8 @@ def status(self) -> AirPurifierStatus: | |
# Second request | ||
'led_b', 'bright', 'buzzer', 'child_lock', 'volume', | ||
'rfid_product_id', 'rfid_tag', 'act_sleep', 'sleep_mode', | ||
'sleep_time', 'sleep_data_num', 'app_extra', 'act_det'] | ||
'sleep_time', 'sleep_data_num', 'app_extra', 'act_det', | ||
'use_time', 'button_pressed'] | ||
|
||
# A single request is limited to 16 properties. Therefore the | ||
# properties are divided into multiple requests | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,9 @@ def __init__(self, *args, **kwargs): | |
'sleep_time': 83890, | ||
'sleep_data_num': 22, | ||
'app_extra': 1, | ||
'act_det': 'off' | ||
'act_det': 'off', | ||
'use_time': '4862700', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dictionary key 'use_time' repeated with different values There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dictionary key 'use_time' repeated with different values |
||
'button_pressed': 'power', | ||
} | ||
self.return_values = { | ||
'get_prop': self._get_state, | ||
|
@@ -120,6 +122,8 @@ def test_status(self): | |
assert self.state().extra_features == self.device.start_state["app_extra"] | ||
assert self.state().turbo_mode_supported == (self.device.start_state["app_extra"] == 1) | ||
assert self.state().auto_detect == (self.device.start_state["act_det"] == 'on') | ||
assert self.state().use_time == self.device.start_state["use_time"] | ||
assert self.state().button_pressed == self.device.start_state["button_pressed"] | ||
|
||
def test_set_mode(self): | ||
def mode(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redefinition of unused 'use_time' from line 176