Skip to content

Commit

Permalink
Return type of the property "volume" should be Optional (#172)
Browse files Browse the repository at this point in the history
* The return type of "volume" is optional now. The Air Purifier 2 doesn't support the property.

* Example payload updated.
  • Loading branch information
syssi authored and rytilahti committed Jan 22, 2018
1 parent ea756d0 commit bc7d07b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions miio/airpurifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ class AirPurifierStatus:

def __init__(self, data: Dict[str, Any]) -> None:
"""
Response of a Air Purifier Pro:
Response of a Air Purifier Pro (zhimi.airpurifier.v6):
['power': 'off', 'aqi': 41, 'humidity': 62, 'temp_dec': 293,
'mode': 'auto', 'led': 'on', 'led_b': null, 'buzzer': null,
'child_lock': 'off', 'limit_hum': null, 'trans_level': null,
'bright': 71, 'favorite_level': 17, 'filter1_life': 77,
'act_det': null, 'f1_hour_used': 771, 'use_time': 2776200,
'motor1_speed': 0]
{'power': 'off', 'aqi': 7, 'average_aqi': 18, 'humidity': 45,
'temp_dec': 234, 'mode': 'auto', 'favorite_level': 17,
'filter1_life': 52, 'f1_hour_used': 1664, 'use_time': 2642700,
'motor1_speed': 0, 'purify_volume': 62180, 'f1_hour': 3500,
'led': 'on', 'led_b': None, 'bright': 83, 'buzzer': None,
'child_lock': 'off', 'volume': 50}
Response of a Air Purifier 2:
Response of a Air Purifier 2 (zhimi.airpurifier.m1):
{'power': 'on, 'aqi': 10, 'average_aqi': 8, 'humidity': 62,
'temp_dec': 186, 'mode': 'auto', 'favorite_level': 10,
'filter1_life': 80, 'f1_hour_used': 682, 'use_time': 2457000,
'motor1_speed': 354, 'purify_volume': 25262, 'f1_hour': 3500,
'led': 'off', 'led_b': 2, 'bright': None, 'buzzer': 'off',
'child_lock': 'off'}
'child_lock': 'off', 'volume': None}
A request is limited to 16 properties.
"""
Expand Down Expand Up @@ -150,7 +150,7 @@ def motor_speed(self) -> int:
return self.data["motor1_speed"]

@property
def volume(self) -> int:
def volume(self) -> Optional[int]:
"""Volume of sound notifications [0-100]."""
return self.data["volume"]

Expand Down

0 comments on commit bc7d07b

Please sign in to comment.