Support smart child modules queries (#967)

Required for the P300 firmware update with `auto_off` module on child
devices. Will query child modules for parent devices that are not hubs.

Coverage will be fixed when the P300 fixture is added
https://github.com/python-kasa/python-kasa/pull/915
This commit is contained in:
Steven B
2024-06-10 15:47:00 +01:00
committed by GitHub
parent 927fe648ac
commit db6276d3fd
6 changed files with 64 additions and 17 deletions

View File

@@ -99,3 +99,11 @@ class AutoOff(SmartModule):
sysinfo = self._device.sys_info
return self._device.time + timedelta(seconds=sysinfo["auto_off_remain_time"])
async def _check_supported(self):
"""Additional check to see if the module is supported by the device.
Parent devices that report components of children such as P300 will not have
the auto_off_status is sysinfo.
"""
return "auto_off_status" in self._device.sys_info