mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Add supported check to light transition module (#971)
Adds an implementation of `_check_supported` to the light transition module so it is not added to a parent device that reports it but doesn't support it, i.e. ks240.
This commit is contained in:
parent
57cbd3cb58
commit
f0be672cf5
@ -181,3 +181,13 @@ class LightTransition(SmartModule):
|
|||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
return {self.QUERY_GETTER_NAME: None}
|
return {self.QUERY_GETTER_NAME: None}
|
||||||
|
|
||||||
|
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 ks240 will not have
|
||||||
|
the brightness value is sysinfo.
|
||||||
|
"""
|
||||||
|
# Look in _device.sys_info here because self.data is either sys_info or
|
||||||
|
# get_preset_rules depending on whether it's a child device or not.
|
||||||
|
return "brightness" in self._device.sys_info
|
||||||
|
Loading…
Reference in New Issue
Block a user