8000 Miscellaneous minor fixes to dump_devinfo by sdb9696 · Pull Request #1382 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

Miscellaneous minor fixes to dump_devinfo #1382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2024
Merged
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
16 changes: 10 additions & 6 deletions devtools/dump_devinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def capture_raw(discovered: DiscoveredRaw):
)
discovery_info = raw_discovery[device.host]
if decrypted_data := device._discovery_info.get("decrypted_data"):
discovery_info["decrypted_data"] = decrypted_data
discovery_info["result"]["decrypted_data"] = decrypted_data
await handle_device(
basedir,
autosave,
Expand All @@ -353,7 +353,7 @@ def capture_raw(discovered: DiscoveredRaw):
for dev in devices.values():
discovery_info = raw_discovery[dev.host]
if decrypted_data := dev._discovery_info.get("decrypted_data"):
discovery_info["decrypted_data"] = decrypted_data
discovery_info["result"]["decrypted_data"] = decrypted_data

await handle_device(
basedir,
Expand Down Expand Up @@ -936,6 +936,7 @@ async def get_smart_fixtures(
and (child_model := response["get_device_info"].get("model"))
and child_model != parent_model
):
response = redact_data(response, _wrap_redactors(SMART_REDACTORS))
fixture_results.append(get_smart_child_fixture(response))
else:
cd = final.setdefault("child_devices", {})
Expand All @@ -951,13 +952,16 @@ async def get_smart_fixtures(
child["device_id"] = scrubbed_device_ids[device_id]

# Scrub the device ids in the parent for the smart camera protocol
if gc := final.get("getChildDeviceList"):
for child in gc["child_device_list"]:
if gc := final.get("getChildDeviceComponentList"):
for child in gc["child_component_list"]:
device_id = child["device_id"]
child["device_id"] = scrubbed_device_ids[device_id]
for child in final["getChildDeviceList"]["child_device_list"]:
if device_id := child.get("device_id"):
child["device_id"] = scrubbed_device_ids[device_id]
continue
if device_id := child.get("dev_id"):
child["dev_id"] = scrubbed_device_ids[device_id]
elif dev_id := child.get("dev_id"):
child["dev_id"] = scrubbed_device_ids[dev_id]
continue
_LOGGER.error("Could not find a device for the child device: %s", child)

Expand Down
Loading
0