1
0
mirror of https://github.com/no2chem/wideq.git synced 2025-05-21 09:30:13 -07:00

Fetch device type

This commit is contained in:
Adrian Sampson 2018-04-03 10:40:38 -04:00
parent 86c63a92b5
commit c696489de2
2 changed files with 37 additions and 1 deletions

View File

@ -23,7 +23,7 @@ def ls(client):
"""List the user's devices.""" """List the user's devices."""
for device in client.devices: for device in client.devices:
print('{0.id}: {0.name} ({0.model_id})'.format(device)) print('{0.id}: {0.name} ({0.type.name} {0.model_id})'.format(device))
def mon(client, device_id): def mon(client, device_id):

View File

@ -515,6 +515,36 @@ class Client(object):
return ModelInfo(self._model_info[url]) return ModelInfo(self._model_info[url])
class DeviceType(enum.Enum):
"""The category of device."""
REFRIGERATOR = 101
KIMCHI_REFRIGERATOR = 102
WATER_PURIFIER = 103
WASHER = 201
DRYER = 202
STYLER = 203
DISHWASHER = 204
OVEN = 301
MICROWAVE = 302
COOKTOP = 303
HOOD = 304
AC = 401 # Includes heat pumps, etc., possibly all HVAC devices.
AIR_PURIFIER = 402
DEHUMIDIFIER = 403
ROBOT_KING = 501 # Robotic vacuum cleaner?
ARCH = 1001
MISSG = 3001
SENSOR = 3002
SOLAR_SENSOR = 3102
IOT_LIGHTING = 3003
IOT_MOTION_SENSOR = 3004
IOT_SMART_PLUG = 3005
IOT_DUST_SENSOR = 3006
EMS_AIR_STATION = 4001
AIR_SENSOR = 4003
class DeviceInfo(object): class DeviceInfo(object):
"""Details about a user's device. """Details about a user's device.
@ -540,6 +570,12 @@ class DeviceInfo(object):
def name(self): def name(self):
return self.data['alias'] return self.data['alias']
@property
def type(self):
"""The kind of device, as a `DeviceType` value."""
return DeviceType(self.data['deviceType'])
def load_model_info(self): def load_model_info(self):
"""Load JSON data describing the model's capabilities. """Load JSON data describing the model's capabilities.
""" """