mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
Extend dump_devinfo iot queries (#1278)
This commit is contained in:
parent
2683623997
commit
bf23f73cce
@ -114,6 +114,7 @@ def scrub(res):
|
||||
"connect_ssid",
|
||||
"encrypt_info",
|
||||
"local_ip",
|
||||
"username",
|
||||
]
|
||||
|
||||
for k, v in res.items():
|
||||
@ -152,7 +153,7 @@ def scrub(res):
|
||||
v = base64.b64encode(b"#MASKED_SSID#").decode()
|
||||
elif k in ["nickname"]:
|
||||
v = base64.b64encode(b"#MASKED_NAME#").decode()
|
||||
elif k in ["alias", "device_alias", "device_name"]:
|
||||
elif k in ["alias", "device_alias", "device_name", "username"]:
|
||||
v = "#MASKED_NAME#"
|
||||
elif isinstance(res[k], int):
|
||||
v = 0
|
||||
@ -398,11 +399,25 @@ async def get_legacy_fixture(
|
||||
items = [
|
||||
Call(module="system", method="get_sysinfo"),
|
||||
Call(module="emeter", method="get_realtime"),
|
||||
Call(module="cnCloud", method="get_info"),
|
||||
Call(module="cnCloud", method="get_intl_fw_list"),
|
||||
Call(module="smartlife.iot.common.schedule", method="get_next_action"),
|
||||
Call(module="smartlife.iot.common.schedule", method="get_rules"),
|
||||
Call(module="schedule", method="get_next_action"),
|
||||
Call(module="schedule", method="get_rules"),
|
||||
Call(module="smartlife.iot.dimmer", method="get_dimmer_parameters"),
|
||||
Call(module="smartlife.iot.dimmer", method="get_default_behavior"),
|
||||
Call(module="smartlife.iot.common.emeter", method="get_realtime"),
|
||||
Call(
|
||||
module="smartlife.iot.smartbulb.lightingservice", method="get_light_state"
|
||||
),
|
||||
Call(
|
||||
module="smartlife.iot.smartbulb.lightingservice",
|
||||
method="get_default_behavior",
|
||||
),
|
||||
Call(
|
||||
module="smartlife.iot.smartbulb.lightingservice", method="get_light_details"
|
||||
),
|
||||
Call(module="smartlife.iot.LAS", method="get_config"),
|
||||
Call(module="smartlife.iot.LAS", method="get_current_brt"),
|
||||
Call(module="smartlife.iot.PIR", method="get_config"),
|
||||
|
@ -213,8 +213,9 @@ class FakeIotTransport(BaseTransport):
|
||||
for target in info:
|
||||
if target != "discovery_result":
|
||||
for cmd in info[target]:
|
||||
# print("initializing tgt %s cmd %s" % (target, cmd))
|
||||
proto[target][cmd] = info[target][cmd]
|
||||
# Use setdefault in case the fixture has modules not yet
|
||||
# part of the baseproto.
|
||||
proto.setdefault(target, {})[cmd] = info[target][cmd]
|
||||
|
||||
# if we have emeter support, we need to add the missing pieces
|
||||
for module in ["emeter", "smartlife.iot.common.emeter"]:
|
||||
|
89
tests/fixtures/KP105(UK)_1.0_1.0.5.json
vendored
89
tests/fixtures/KP105(UK)_1.0_1.0.5.json
vendored
@ -1,7 +1,82 @@
|
||||
{
|
||||
"cnCloud": {
|
||||
"get_info": {
|
||||
"binded": 1,
|
||||
"cld_connection": 0,
|
||||
"err_code": 0,
|
||||
"fwDlPage": "",
|
||||
"fwNotifyType": -1,
|
||||
"illegalType": 0,
|
||||
"server": "n-devs.tplinkcloud.com",
|
||||
"stopConnect": 0,
|
||||
"tcspInfo": "",
|
||||
"tcspStatus": 1,
|
||||
"username": "#MASKED_NAME#"
|
||||
},
|
||||
"get_intl_fw_list": {
|
||||
"err_code": -7,
|
||||
"err_msg": "unknown error"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
"get_next_action": {
|
||||
"action": 1,
|
||||
"err_code": 0,
|
||||
"id": "0794F4729DB271627D1CF35A9A854030",
|
||||
"schd_time": 68927,
|
||||
"type": 2
|
||||
},
|
||||
"get_rules": {
|
||||
"enable": 1,
|
||||
"err_code": 0,
|
||||
"rule_list": [
|
||||
{
|
||||
"eact": -1,
|
||||
"enable": 1,
|
||||
"id": "8AA75A50A8440B17941D192BD9E01FFA",
|
||||
"name": "name",
|
||||
"repeat": 1,
|
||||
"sact": 1,
|
||||
"smin": 1027,
|
||||
"soffset": 0,
|
||||
"stime_opt": 2,
|
||||
"wday": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"eact": -1,
|
||||
"enable": 1,
|
||||
"id": "9F62073CF69D8645173412283AD63A2C",
|
||||
"name": "name",
|
||||
"repeat": 1,
|
||||
"sact": 0,
|
||||
"smin": 504,
|
||||
"soffset": 0,
|
||||
"stime_opt": 1,
|
||||
"wday": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 2
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"get_sysinfo": {
|
||||
"active_mode": "schedule",
|
||||
"active_mode": "count_down",
|
||||
"alias": "#MASKED_NAME#",
|
||||
"dev_name": "Smart Wi-Fi Plug",
|
||||
"deviceId": "0000000000000000000000000000000000000000",
|
||||
@ -18,16 +93,16 @@
|
||||
"model": "KP105(UK)",
|
||||
"next_action": {
|
||||
"action": 1,
|
||||
"id": "8AA75A50A8440B17941D192BD9E01FFA",
|
||||
"schd_sec": 59160,
|
||||
"type": 1
|
||||
"id": "0794F4729DB271627D1CF35A9A854030",
|
||||
"schd_sec": 68927,
|
||||
"type": 2
|
||||
},
|
||||
"ntc_state": 0,
|
||||
"obd_src": "tplink",
|
||||
"oemId": "00000000000000000000000000000000",
|
||||
"on_time": 0,
|
||||
"relay_state": 0,
|
||||
"rssi": -66,
|
||||
"on_time": 7138,
|
||||
"relay_state": 1,
|
||||
"rssi": -77,
|
||||
"status": "configured",
|
||||
"sw_ver": "1.0.5 Build 191209 Rel.094735",
|
||||
"updating": 0
|
||||
|
Loading…
Reference in New Issue
Block a user