GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Better checking of child modules not supported by parent device (#966) · pillarsdotnet/python-kasa@a044f2f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • kasa/smart
    • modules
      • lightpreset.py
    • smartdevice.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎kasa/smart/modules/lightpreset.py‎

Copy file name to clipboardExpand all lines: kasa/smart/modules/lightpreset.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,13 @@ def query(self) -> dict:
140140
if self._state_in_sysinfo: # Child lights can have states in the child info
141141
return {}
142142
return {self.QUERY_GETTER_NAME: None}
143+
144+
async def _check_supported(self):
145+
"""Additional check to see if the module is supported by the device.
146+
147+
Parent devices that report components of children such as ks240 will not have
148+
the brightness value is sysinfo.
149+
"""
150+
# Look in _device.sys_info here because self.data is either sys_info or
151+
# get_preset_rules depending on whether it's a child device or not.
152+
return "brightness" in self._device.sys_info
Collapse file

‎kasa/smart/smartdevice.py‎

Copy file name to clipboardExpand all lines: kasa/smart/smartdevice.py
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,6 @@ async def _initialize_modules(self):
202202
child_modules_to_skip = {}
203203
if self._parent and self._parent.device_type != DeviceType.Hub:
204204
skip_parent_only_modules = True
205-
elif self._children and self.device_type == DeviceType.WallSwitch:
206-
# _initialize_modules is called on the parent after the children
207-
for child in self._children.values():
208-
child_modules_to_skip.update(**child.modules)
209205

210206
for mod in SmartModule.REGISTERED_MODULES.values():
211207
_LOGGER.debug("%s requires %s", mod, mod.REQUIRED_COMPONENT)

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.