Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 16 additions & 1 deletion devtools/dump_devinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def scrub(res):
"connect_ssid",
"encrypt_info",
"local_ip",
"username",
]

for k, v in res.items():
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down
5 changes: 3 additions & 2 deletions tests/fakeprotocol_iot.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ def _build_fake_proto(info):
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"]:
Expand Down
89 changes: 82 additions & 7 deletions tests/fixtures/KP105(UK)_1.0_1.0.5.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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
Expand Down
Loading