mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-21 23:08:01 +00:00
Do not expose child modules on parent devices (#964)
Removes the logic to expose child modules on parent devices, which could cause complications with downstream consumers unknowingly duplicating things.
This commit is contained in:
@@ -434,3 +434,16 @@ async def dev(request) -> AsyncGenerator[Device, None]:
|
||||
yield dev
|
||||
|
||||
await dev.disconnect()
|
||||
|
||||
|
||||
def get_parent_and_child_modules(device: Device, module_name):
|
||||
"""Return iterator of module if exists on parent and children.
|
||||
|
||||
Useful for testing devices that have components listed on the parent that are only
|
||||
supported on the children, i.e. ks240.
|
||||
"""
|
||||
if module_name in device.modules:
|
||||
yield device.modules[module_name]
|
||||
for child in device.children:
|
||||
if module_name in child.modules:
|
||||
yield child.modules[module_name]
|
||||
|
Reference in New Issue
Block a user