Add new methods to dump_devinfo and mask aliases (#574)

This commit is contained in:
sdb9696 2023-12-08 13:29:07 +00:00 committed by GitHub
parent be289a5751
commit b27a31a8a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -44,6 +44,8 @@ def scrub(res):
"hw_id", "hw_id",
"fw_id", "fw_id",
"oem_id", "oem_id",
"nickname",
"alias",
] ]
for k, v in res.items(): for k, v in res.items():
@ -57,7 +59,11 @@ def scrub(res):
v = "127.0.0.123" v = "127.0.0.123"
elif k in ["ssid"]: elif k in ["ssid"]:
# Need a valid base64 value here # Need a valid base64 value here
v = base64.b64encode(b"##MASKEDNAME##").decode() v = base64.b64encode(b"#MASKED_SSID#").decode()
elif k in ["nickname"]:
v = base64.b64encode(b"#MASKED_NAME#").decode()
elif k in ["alias"]:
v = "#MASKED_NAME#"
else: else:
v = re.sub(r"\w", "0", v) v = re.sub(r"\w", "0", v)
@ -203,6 +209,12 @@ async def get_smart_fixture(device: SmartDevice):
Call(module="device_time", method="get_device_time"), Call(module="device_time", method="get_device_time"),
Call(module="energy_usage", method="get_energy_usage"), Call(module="energy_usage", method="get_energy_usage"),
Call(module="current_power", method="get_current_power"), Call(module="current_power", method="get_current_power"),
Call(module="temp_humidity_records", method="get_temp_humidity_records"),
Call(module="child_device_list", method="get_child_device_list"),
Call(
module="trigger_logs",
method={"get_trigger_logs": {"page_size": 5, "start_id": 0}},
),
Call( Call(
module="child_device_component_list", module="child_device_component_list",
method="get_child_device_component_list", method="get_child_device_component_list",

View File

@ -17,7 +17,7 @@
"system": { "system": {
"get_sysinfo": { "get_sysinfo": {
"active_mode": "none", "active_mode": "none",
"alias": "Bedroom Lamp 2", "alias": "#MASKED_NAME#",
"dev_name": "Smart Wi-Fi Plug", "dev_name": "Smart Wi-Fi Plug",
"deviceId": "0000000000000000000000000000000000000000", "deviceId": "0000000000000000000000000000000000000000",
"err_code": 0, "err_code": 0,

View File

@ -128,7 +128,7 @@
"longitude": 0, "longitude": 0,
"mac": "00-00-00-00-00-00", "mac": "00-00-00-00-00-00",
"model": "P110", "model": "P110",
"nickname": "VGFwaSBTbWFydCBQbHVnIDE=", "nickname": "I01BU0tFRF9OQU1FIw==",
"oem_id": "00000000000000000000000000000000", "oem_id": "00000000000000000000000000000000",
"on_time": 119335, "on_time": 119335,
"overcurrent_status": "normal", "overcurrent_status": "normal",
@ -138,7 +138,7 @@
"rssi": -57, "rssi": -57,
"signal_level": 2, "signal_level": 2,
"specs": "", "specs": "",
"ssid": "IyNNQVNLRUROQU1FIyM=", "ssid": "I01BU0tFRF9TU0lEIw==",
"time_diff": 0, "time_diff": 0,
"type": "SMART.TAPOPLUG" "type": "SMART.TAPOPLUG"
}, },