8000 Add supported check to light transition module (#971) · python-kasa/python-kasa@f0be672 · GitHub
[go: up one dir, main page]

Skip to content

Commit f0be672

Browse files
authored
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.
1 parent 57cbd3c commit f0be672

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kasa/smart/modules/lighttransition.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,13 @@ def query(self) -> dict:
181181
return {}
182182
else:
183183
return {self.QUERY_GETTER_NAME: None}
184+
185+
async def _check_supported(self):
186+
"""Additional check to see if the module is supported by the device.
187+
188+
Parent devices that report components of children such as ks240 will not have
189+
the brightness value is sysinfo.
190+
"""
191+
# Look in _device.sys_info here because self.data is either sys_info or
192+
# get_preset_rules depending on whether it's a child device or not.
193+
return "brightness" in self._device.sys_info

0 commit comments

Comments
 (0)
0