mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-27 10:31:59 +00:00
Change state_information to return feature values (#804)
This changes `state_information` to return the names and values of all defined features. It was originally a "temporary" hack to show some extra, device-specific information in the cli tool, but now that we have device-defined features we can leverage them.
This commit is contained in:
@@ -121,6 +121,61 @@ TIME_MODULE = {
|
||||
"set_timezone": None,
|
||||
}
|
||||
|
||||
CLOUD_MODULE = {
|
||||
"get_info": {
|
||||
"username": "",
|
||||
"server": "devs.tplinkcloud.com",
|
||||
"binded": 0,
|
||||
"cld_connection": 0,
|
||||
"illegalType": -1,
|
||||
"stopConnect": -1,
|
||||
"tcspStatus": -1,
|
||||
"fwDlPage": "",
|
||||
"tcspInfo": "",
|
||||
"fwNotifyType": 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AMBIENT_MODULE = {
|
||||
"get_current_brt": {"value": 26, "err_code": 0},
|
||||
"get_config": {
|
||||
"devs": [
|
||||
{
|
||||
"hw_id": 0,
|
||||
"enable": 0,
|
||||
"dark_index": 1,
|
||||
"min_adc": 0,
|
||||
"max_adc": 2450,
|
||||
"level_array": [
|
||||
{"name": "cloudy", "adc": 490, "value": 20},
|
||||
{"name": "overcast", "adc": 294, "value": 12},
|
||||
{"name": "dawn", "adc": 222, "value": 9},
|
||||
{"name": "twilight", "adc": 222, "value": 9},
|
||||
{"name": "total darkness", "adc": 111, "value": 4},
|
||||
{"name": "custom", "adc": 2400, "value": 97},
|
||||
],
|
||||
}
|
||||
],
|
||||
"ver": "1.0",
|
||||
"err_code": 0,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
MOTION_MODULE = {
|
||||
"get_config": {
|
||||
"enable": 0,
|
||||
"version": "1.0",
|
||||
"trigger_index": 2,
|
||||
"cold_time": 60000,
|
||||
"min_adc": 0,
|
||||
"max_adc": 4095,
|
||||
"array": [80, 50, 20, 0],
|
||||
"err_code": 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class FakeIotProtocol(IotProtocol):
|
||||
def __init__(self, info):
|
||||
@@ -306,8 +361,10 @@ class FakeIotProtocol(IotProtocol):
|
||||
"set_brightness": set_hs220_brightness,
|
||||
"set_dimmer_transition": set_hs220_dimmer_transition,
|
||||
},
|
||||
"smartlife.iot.LAS": {},
|
||||
"smartlife.iot.PIR": {},
|
||||
"smartlife.iot.LAS": AMBIENT_MODULE,
|
||||
"smartlife.iot.PIR": MOTION_MODULE,
|
||||
"cnCloud": CLOUD_MODULE,
|
||||
"smartlife.iot.common.cloud": CLOUD_MODULE,
|
||||
}
|
||||
|
||||
async def query(self, request, port=9999):
|
||||
|
||||
Reference in New Issue
Block a user