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:
Steven B 2024-06-11 15:46:36 +01:00 committed by GitHub
parent 57cbd3cb58
commit f0be672cf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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