8000 Extend dump_devinfo iot queries (#1278) · ryenitcher/python-kasa@bf23f73 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf23f73

Browse files
authored
Extend dump_devinfo iot queries (python-kasa#1278)
1 parent 2683623 commit bf23f73

File tree

3 files changed

+101
-10
lines changed

3 files changed

+101
-10
lines changed

devtools/dump_devinfo.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def scrub(res):
114114
"connect_ssid",
115115
"encrypt_info",
116116
"local_ip",
117+
"username",
117118
]
118119

119120
for k, v in res.items():
@@ -152,7 +153,7 @@ def scrub(res):
152153
v = base64.b64encode(b"#MASKED_SSID#").decode()
153154
elif k in ["nickname"]:
154155
v = base64.b64encode(b"#MASKED_NAME#").decode()
155-
elif k in ["alias", "device_alias", "device_name"]:
156+
elif k in ["alias", "device_alias", "device_name", "username"]:
156157
v = "#MASKED_NAME#"
157158
elif isinstance(res[k], int):
158159
v = 0
@@ -398,11 +399,25 @@ async def get_legacy_fixture(
398399
items = [
399400
Call(module="system", method="get_sysinfo"),
400401
Call(module="emeter", method="get_realtime"),
402+
Call(module="cnCloud", method="get_info"),
403+
Call(module="cnCloud", method="get_intl_fw_list"),
404+
Call(module="smartlife.iot.common.schedule", method="get_next_action"),
405+
Call(module="smartlife.iot.common.schedule", method="get_rules"),
406+
Call(module="schedule", method="get_next_action"),
407+
Call(module="schedule", method="get_rules"),
401408
Call(module="smartlife.iot.dimmer", method="get_dimmer_parameters"),
409+
Call(module="smartlife.iot.dimmer", method="get_default_behavior"),
402410
Call(module="smartlife.iot.common.emeter", method="get_realtime"),
403411
Call(
404412
module="smartlife.iot.smartbulb.lightingservice", method="get_light_state"
405413
),
414+
Call(
415+
module="smartlife.iot.smartbulb.lightingservice",
416+
method="get_default_behavior",
417+
),
418+
Call(
419+
module="smartlife.iot.smartbulb.lightingservice", method="get_light_details"
420+
),
406421
Call(module="smartlife.iot.LAS", method="get_config"),
407422
Call(module="smartlife.iot.LAS", method="get_current_brt"),
408423
Call(module="smartlife.iot.PIR", method="get_config"),

tests/fakeprotocol_iot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ def _build_fake_proto(info):
213213
for target in info:
214214
if target != "discovery_result":
215215
for cmd in info[target]:
216-
# print("initializing tgt %s cmd %s" % (target, cmd))
217-
proto[target][cmd] = info[target][cmd]
216+
# Use setdefault in case the fixture has modules not yet
217+
# part of the baseproto.
218+
proto.setdefault(target, {})[cmd] = info[target][cmd]
218219

219220
# if we have emeter support, we need to add the missing pieces
220221
for module in ["emeter", "smartlife.iot.common.emeter"]:

tests/fixtures/KP105(UK)_1.0_1.0.5.json

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,82 @@
11
{
2+
"cnCloud": {
3+
"get_info": {
4+
"binded": 1,
5+
"cld_connection": 0,
6+
"err_code": 0,
7+
"fwDlPage": "",
8+
"fwNotifyType": -1,
9+< 8000 /span>
"illegalType": 0,
10+
"server": "n-devs.tplinkcloud.com",
11+
"stopConnect": 0,
12+
"tcspInfo": "",
13+
"tcspStatus": 1,
14+
"username": "#MASKED_NAME#"
15+
},
16+
"get_intl_fw_list": {
17+
"err_code": -7,
18+
"err_msg": "unknown error"
19+
}
20+
},
21+
"schedule": {
22+
"get_next_action": {
23+
"action": 1,
24+
"err_code": 0,
25+
"id": "0794F4729DB271627D1CF35A9A854030",
26+
"schd_time": 68927,
27+
"type": 2
28+
},
29+
"get_rules": {
30+
"enable": 1,
31+
"err_code": 0,
32+
"rule_list": [
33+
{
34+
"eact": -1,
35+
"enable": 1,
36+
"id": "8AA75A50A8440B17941D192BD9E01FFA",
37+
"name": "name",
38+
"repeat": 1,
39+
"sact": 1,
40+
"smin": 1027,
41+
"soffset": 0,
42+
"stime_opt": 2,
43+
"wday": [
44+
1,
45+
1,
46+
1,
47+
1,
48+
1,
49+
1,
50+
1
51+
]
52+
},
53+
{
54+
"eact": -1,
55+
"enable": 1,
56+
"id": "9F62073CF69D8645173412283AD63A2C",
57+
"name": "name",
58+
"repeat": 1,
59+
"sact": 0,
60+
"smin": 504,
61+
"soffset": 0,
62+
"stime_opt": 1,
63+
"wday": [
64+
1,
65+
1,
66+
1,
67+
1,
68+
1,
69+
1,
70+
1
71+
]
72+
}
73+
],
74+
"version": 2
75+
}
76+
},
277
"system": {
378
"get_sysinfo": {
4-
"active_mode": "schedule",
79+
"active_mode": "count_down",
580
"alias": "#MASKED_NAME#",
681
"dev_name": "Smart Wi-Fi Plug",
782
"deviceId": "0000000000000000000000000000000000000000",
@@ -18,16 +93,16 @@
1893
"model": "KP105(UK)",
1994
"next_action": {
2095
"action": 1,
21-
"id": "8AA75A50A8440B17941D192BD9E01FFA",
22-
"schd_sec": 59160,
23-
"type": 1
96+
"id": "0794F4729DB271627D1CF35A9A854030",
97+
"schd_sec": 68927,
98+
"type": 2
2499
},
25100
"ntc_state": 0,
26101
"obd_src": "tplink",
27102
"oemId": "00000000000000000000000000000000",
28-
"on_time": 0,
29-
"relay_state": 0,
30-
"rssi": -66,
103+
"on_time": 7138,
104+
"relay_state": 1,
105+
"rssi": -77,
31106
"status": "configured",
32107
"sw_ver": "1.0.5 Build 191209 Rel.094735",
33108
"updating": 0

0 commit comments

Comments
 (0)
0