From b27a31a8a96cbd88d2bed77c95695f5da9eb5209 Mon Sep 17 00:00:00 2001 From: sdb9696 <51370195+sdb9696@users.noreply.github.com> Date: Fri, 8 Dec 2023 13:29:07 +0000 Subject: [PATCH] Add new methods to dump_devinfo and mask aliases (#574) --- devtools/dump_devinfo.py | 14 +++++++++++++- kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json | 2 +- kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/devtools/dump_devinfo.py b/devtools/dump_devinfo.py index 30f4ba1f..c9f34fcb 100644 --- a/devtools/dump_devinfo.py +++ b/devtools/dump_devinfo.py @@ -44,6 +44,8 @@ def scrub(res): "hw_id", "fw_id", "oem_id", + "nickname", + "alias", ] for k, v in res.items(): @@ -57,7 +59,11 @@ def scrub(res): v = "127.0.0.123" elif k in ["ssid"]: # 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: 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="energy_usage", method="get_energy_usage"), 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( module="child_device_component_list", method="get_child_device_component_list", diff --git a/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json b/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json index 2425c17f..7caf6aeb 100644 --- a/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +++ b/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json @@ -17,7 +17,7 @@ "system": { "get_sysinfo": { "active_mode": "none", - "alias": "Bedroom Lamp 2", + "alias": "#MASKED_NAME#", "dev_name": "Smart Wi-Fi Plug", "deviceId": "0000000000000000000000000000000000000000", "err_code": 0, diff --git a/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json b/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json index 99fd3f13..9033e800 100644 --- a/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json +++ b/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json @@ -128,7 +128,7 @@ "longitude": 0, "mac": "00-00-00-00-00-00", "model": "P110", - "nickname": "VGFwaSBTbWFydCBQbHVnIDE=", + "nickname": "I01BU0tFRF9OQU1FIw==", "oem_id": "00000000000000000000000000000000", "on_time": 119335, "overcurrent_status": "normal", @@ -138,7 +138,7 @@ "rssi": -57, "signal_level": 2, "specs": "", - "ssid": "IyNNQVNLRUROQU1FIyM=", + "ssid": "I01BU0tFRF9TU0lEIw==", "time_diff": 0, "type": "SMART.TAPOPLUG" },