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

Return type of the property "volume" should be Optional #172

Merged
merged 2 commits into from
Jan 22, 2018
Merged
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
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