FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Exclude querying certain modules for KL125(US) which cause crashes by brianthedavis · Pull Request #451 · python-kasa/python-kasa · GitHub

Repository navigation

10 changes: 9 additions & 1 deletion kasa/smartdevice.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

_LOGGER = logging.getLogger(__name__)

# Certain module queries will crash devices; this list skips those queries
MODEL_MODULE_SKIPLIST = {"KL125(US)": ["cloud"]} # Issue #345


class DeviceType(Enum):
"""Device type enum."""
Expand Down Expand Up @@ -325,10 +328,15 @@ async def _modular_update(self, req: dict) -> None:
)
self.add_module("emeter", Emeter(self, self.emeter_type))

for module in self.modules.values():
for module_name, module in self.modules.items():
if not module.is_supported:
_LOGGER.debug("Module %s not supported, skipping" % module)
continue
modules_to_skip = MODEL_MODULE_SKIPLIST.get(self.model, [])
if module_name in modules_to_skip:
_LOGGER.debug(f"Module {module} is excluded for {self.model}, skipping")
continue

q = module.query()
_LOGGER.debug("Adding query for %s: %s", module, q)
req = merge(req, q)
Expand Down

Back | FazBrowse Home | New Git URL