mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Add new methods to dump_devinfo and mask aliases (#574)
This commit is contained in:
parent
be289a5751
commit
b27a31a8a9
@ -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",
|
||||
|
2
kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json
vendored
2
kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json
vendored
@ -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,
|
||||
|
@ -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"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user