mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-08 03:34:02 +00:00
Do not request unsupported modules after the initial update (#298)
* Do not request unsupported modules after the initial update * debugify logging
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""Base class for all module implementations."""
|
||||
import collections
|
||||
import logging
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
@@ -7,6 +8,9 @@ if TYPE_CHECKING:
|
||||
from kasa import SmartDevice
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# TODO: This is used for query construcing
|
||||
def merge(d, u):
|
||||
"""Update dict recursively."""
|
||||
@@ -45,6 +49,10 @@ class Module(ABC):
|
||||
@property
|
||||
def is_supported(self) -> bool:
|
||||
"""Return whether the module is supported by the device."""
|
||||
if self._module not in self._device._last_update:
|
||||
_LOGGER.debug("Initial update, so consider supported: %s", self._module)
|
||||
return True
|
||||
|
||||
return "err_code" not in self.data
|
||||
|
||||
def call(self, method, params=None):
|
||||
|
Reference in New Issue
Block a user