Generalize smartdevice child support

* Initialize children's modules (and features) using the child component negotiation results
* Set device_type based on the device response
* Print out child features in cli 'state'
* Add --child option to cli 'command' to allow targeting child devices
* Guard "generic" features like rssi, ssid, etc. only to devices which have this information
This commit is contained in:
Teemu Rytilahti
2024-02-20 00:26:47 +01:00
parent efb4a0f31f
commit bced5e40c5
6 changed files with 124 additions and 51 deletions

View File

@@ -255,7 +255,9 @@ async def test_device_class_ctors(device_class_name_obj):
klass = device_class_name_obj[1]
if issubclass(klass, SmartChildDevice):
parent = SmartDevice(host, config=config)
dev = klass(parent, 1)
dev = klass(
parent, {"dummy": "info", "device_id": "dummy"}, {"dummy": "components"}
)
else:
dev = klass(host, config=config)
assert dev.host == host