python-kasa 0.7.0.3__py3-none-any.whl → 0.7.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kasa/aestransport.py CHANGED
@@ -144,7 +144,9 @@ class AesTransport(BaseTransport):
144
144
  try:
145
145
  error_code = SmartErrorCode.from_int(error_code_raw)
146
146
  except ValueError:
147
- _LOGGER.warning("Received unknown error code: %s", error_code_raw)
147
+ _LOGGER.warning(
148
+ "Device %s received unknown error code: %s", self._host, error_code_raw
149
+ )
148
150
  error_code = SmartErrorCode.INTERNAL_UNKNOWN_ERROR
149
151
  if error_code is SmartErrorCode.SUCCESS:
150
152
  return
@@ -214,10 +216,18 @@ class AesTransport(BaseTransport):
214
216
  """Login to the device."""
215
217
  try:
216
218
  await self.try_login(self._login_params)
219
+ _LOGGER.debug(
220
+ "%s: logged in with provided credentials",
221
+ self._host,
222
+ )
217
223
  except AuthenticationError as aex:
218
224
  try:
219
225
  if aex.error_code is not SmartErrorCode.LOGIN_ERROR:
220
226
  raise aex
227
+ _LOGGER.debug(
228
+ "%s: trying login with default TAPO credentials",
229
+ self._host,
230
+ )
221
231
  if self._default_credentials is None:
222
232
  self._default_credentials = get_default_credentials(
223
233
  DEFAULT_CREDENTIALS["TAPO"]
@@ -225,7 +235,7 @@ class AesTransport(BaseTransport):
225
235
  await self.perform_handshake()
226
236
  await self.try_login(self._get_login_params(self._default_credentials))
227
237
  _LOGGER.debug(
228
- "%s: logged in with default credentials",
238
+ "%s: logged in with default TAPO credentials",
229
239
  self._host,
230
240
  )
231
241
  except (AuthenticationError, _ConnectionError, TimeoutError):
kasa/exceptions.py CHANGED
@@ -128,6 +128,8 @@ class SmartErrorCode(IntEnum):
128
128
 
129
129
  # Library internal for unknown error codes
130
130
  INTERNAL_UNKNOWN_ERROR = -100_000
131
+ # Library internal for query errors
132
+ INTERNAL_QUERY_ERROR = -100_001
131
133
 
132
134
 
133
135
  SMART_RETRYABLE_ERRORS = [
kasa/httpclient.py CHANGED
@@ -75,13 +75,21 @@ class HttpClient:
75
75
  now = time.time()
76
76
  gap = now - self._last_request_time
77
77
  if gap < self._wait_between_requests:
78
- await asyncio.sleep(self._wait_between_requests - gap)
78
+ sleep = self._wait_between_requests - gap
79
+ _LOGGER.debug(
80
+ "Device %s waiting %s seconds to send request",
81
+ self._config.host,
82
+ sleep,
83
+ )
84
+ await asyncio.sleep(sleep)
79
85
 
80
86
  _LOGGER.debug("Posting to %s", url)
81
87
  response_data = None
82
88
  self._last_url = url
83
89
  self.client.cookie_jar.clear()
84
90
  return_json = bool(json)
91
+ client_timeout = aiohttp.ClientTimeout(total=self._config.timeout)
92
+
85
93
  # If json is not a dict send as data.
86
94
  # This allows the json parameter to be used to pass other
87
95
  # types of data such as async_generator and still have json
@@ -95,9 +103,10 @@ class HttpClient:
95
103
  params=params,
96
104
  data=data,
97
105
  json=json,
98
- timeout=self._config.timeout,
106
+ timeout=client_timeout,
99
107
  cookies=cookies_dict,
100
108
  headers=headers,
109
+ ssl=False,
101
110
  )
102
111
  async with resp:
103
112
  if resp.status == 200:
@@ -106,9 +115,15 @@ class HttpClient:
106
115
  response_data = json_loads(response_data.decode())
107
116
 
108
117
  except (aiohttp.ServerDisconnectedError, aiohttp.ClientOSError) as ex:
109
- if isinstance(ex, aiohttp.ClientOSError):
118
+ if not self._wait_between_requests:
119
+ _LOGGER.debug(
120
+ "Device %s received an os error, "
121
+ "enabling sequential request delay: %s",
122
+ self._config.host,
123
+ ex,
124
+ )
110
125
  self._wait_between_requests = self.WAIT_BETWEEN_REQUESTS_ON_OSERROR
111
- self._last_request_time = time.time()
126
+ self._last_request_time = time.time()
112
127
  raise _ConnectionError(
113
128
  f"Device connection error: {self._config.host}: {ex}", ex
114
129
  ) from ex
@@ -16,6 +16,7 @@ class Cloud(SmartModule):
16
16
 
17
17
  QUERY_GETTER_NAME = "get_connect_cloud_state"
18
18
  REQUIRED_COMPONENT = "cloud_connect"
19
+ MINIMUM_UPDATE_INTERVAL_SECS = 60
19
20
 
20
21
  def _post_update_hook(self):
21
22
  """Perform actions after a device update.
@@ -14,7 +14,7 @@ from async_timeout import timeout as asyncio_timeout
14
14
  from pydantic.v1 import BaseModel, Field, validator
15
15
 
16
16
  from ...feature import Feature
17
- from ..smartmodule import SmartModule
17
+ from ..smartmodule import SmartModule, allow_update_after
18
18
 
19
19
  if TYPE_CHECKING:
20
20
  from ..smartdevice import SmartDevice
@@ -66,6 +66,7 @@ class Firmware(SmartModule):
66
66
  """Implementation of firmware module."""
67
67
 
68
68
  REQUIRED_COMPONENT = "firmware"
69
+ MINIMUM_UPDATE_INTERVAL_SECS = 60 * 60 * 24
69
70
 
70
71
  def __init__(self, device: SmartDevice, module: str):
71
72
  super().__init__(device, module)
@@ -122,13 +123,6 @@ class Firmware(SmartModule):
122
123
  req["get_auto_update_info"] = None
123
124
  return req
124
125
 
125
- def _post_update_hook(self):
126
- """Perform actions after a device update.
127
-
128
- Overrides the default behaviour to disable a module if the query returns
129
- an error because some of the module still functions.
130
- """
131
-
132
126
  @property
133
127
  def current_firmware(self) -> str:
134
128
  """Return the current firmware version."""
@@ -162,6 +156,7 @@ class Firmware(SmartModule):
162
156
  state = resp["get_fw_download_state"]
163
157
  return DownloadState(**state)
164
158
 
159
+ @allow_update_after
165
160
  async def update(
166
161
  self, progress_cb: Callable[[DownloadState], Coroutine] | None = None
167
162
  ):
@@ -219,6 +214,7 @@ class Firmware(SmartModule):
219
214
  and self.data["get_auto_update_info"]["enable"]
220
215
  )
221
216
 
217
+ @allow_update_after
222
218
  async def set_auto_update_enabled(self, enabled: bool):
223
219
  """Change autoupdate setting."""
224
220
  data = {**self.data["get_auto_update_info"], "enable": enabled}
kasa/smart/modules/led.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from ...interfaces.led import Led as LedInterface
6
- from ..smartmodule import SmartModule
6
+ from ..smartmodule import SmartModule, allow_update_after
7
7
 
8
8
 
9
9
  class Led(SmartModule, LedInterface):
@@ -11,6 +11,8 @@ class Led(SmartModule, LedInterface):
11
11
 
12
12
  REQUIRED_COMPONENT = "led"
13
13
  QUERY_GETTER_NAME = "get_led_info"
14
+ # Led queries can cause device to crash on P100
15
+ MINIMUM_UPDATE_INTERVAL_SECS = 60 * 60
14
16
 
15
17
  def query(self) -> dict:
16
18
  """Query to execute during the update cycle."""
@@ -29,6 +31,7 @@ class Led(SmartModule, LedInterface):
29
31
  """Return current led status."""
30
32
  return self.data["led_rule"] != "never"
31
33
 
34
+ @allow_update_after
32
35
  async def set_led(self, enable: bool):
33
36
  """Set led.
34
37
 
@@ -9,7 +9,7 @@ import copy
9
9
  from typing import Any
10
10
 
11
11
  from ..effects import SmartLightEffect
12
- from ..smartmodule import Module, SmartModule
12
+ from ..smartmodule import Module, SmartModule, allow_update_after
13
13
 
14
14
 
15
15
  class LightEffect(SmartModule, SmartLightEffect):
@@ -17,6 +17,7 @@ class LightEffect(SmartModule, SmartLightEffect):
17
17
 
18
18
  REQUIRED_COMPONENT = "light_effect"
19
19
  QUERY_GETTER_NAME = "get_dynamic_light_effect_rules"
20
+ MINIMUM_UPDATE_INTERVAL_SECS = 60
20
21
  AVAILABLE_BULB_EFFECTS = {
21
22
  "L1": "Party",
22
23
  "L2": "Relax",
@@ -130,6 +131,7 @@ class LightEffect(SmartModule, SmartLightEffect):
130
131
 
131
132
  return brightness
132
133
 
134
+ @allow_update_after
133
135
  async def set_brightness(
134
136
  self,
135
137
  brightness: int,
@@ -156,6 +158,7 @@ class LightEffect(SmartModule, SmartLightEffect):
156
158
 
157
159
  return await self.call("edit_dynamic_light_effect_rule", new_effect)
158
160
 
161
+ @allow_update_after
159
162
  async def set_custom_effect(
160
163
  self,
161
164
  effect_dict: dict,
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
8
8
 
9
9
  from ...interfaces import LightPreset as LightPresetInterface
10
10
  from ...interfaces import LightState
11
- from ..smartmodule import SmartModule
11
+ from ..smartmodule import SmartModule, allow_update_after
12
12
 
13
13
  if TYPE_CHECKING:
14
14
  from ..smartdevice import SmartDevice
@@ -19,6 +19,7 @@ class LightPreset(SmartModule, LightPresetInterface):
19
19
 
20
20
  REQUIRED_COMPONENT = "preset"
21
21
  QUERY_GETTER_NAME = "get_preset_rules"
22
+ MINIMUM_UPDATE_INTERVAL_SECS = 60
22
23
 
23
24
  SYS_INFO_STATE_KEY = "preset_state"
24
25
 
@@ -113,6 +114,7 @@ class LightPreset(SmartModule, LightPresetInterface):
113
114
  raise ValueError(f"{preset_name} is not a valid preset: {self.preset_list}")
114
115
  await self._device.modules[SmartModule.Light].set_state(preset)
115
116
 
117
+ @allow_update_after
116
118
  async def save_preset(
117
119
  self,
118
120
  preset_name: str,
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  from typing import TYPE_CHECKING
6
6
 
7
7
  from ..effects import EFFECT_MAPPING, EFFECT_NAMES, SmartLightEffect
8
- from ..smartmodule import Module, SmartModule
8
+ from ..smartmodule import Module, SmartModule, allow_update_after
9
9
 
10
10
  if TYPE_CHECKING:
11
11
  from ..smartdevice import SmartDevice
@@ -84,6 +84,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
84
84
  """
85
85
  return self._effect_list
86
86
 
87
+ @allow_update_after
87
88
  async def set_effect(
88
89
  self,
89
90
  effect: str,
@@ -126,6 +127,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
126
127
 
127
128
  await self.set_custom_effect(effect_dict)
128
129
 
130
+ @allow_update_after
129
131
  async def set_custom_effect(
130
132
  self,
131
133
  effect_dict: dict,
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, TypedDict
6
6
 
7
7
  from ...exceptions import KasaException
8
8
  from ...feature import Feature
9
- from ..smartmodule import SmartModule
9
+ from ..smartmodule import SmartModule, allow_update_after
10
10
 
11
11
  if TYPE_CHECKING:
12
12
  from ..smartdevice import SmartDevice
@@ -23,6 +23,7 @@ class LightTransition(SmartModule):
23
23
 
24
24
  REQUIRED_COMPONENT = "on_off_gradually"
25
25
  QUERY_GETTER_NAME = "get_on_off_gradually_info"
26
+ MINIMUM_UPDATE_INTERVAL_SECS = 60
26
27
  MAXIMUM_DURATION = 60
27
28
 
28
29
  # Key in sysinfo that indicates state can be retrieved from there.
@@ -136,6 +137,7 @@ class LightTransition(SmartModule):
136
137
  "max_duration": off_max,
137
138
  }
138
139
 
140
+ @allow_update_after
139
141
  async def set_enabled(self, enable: bool):
140
142
  """Enable gradual on/off."""
141
143
  if not self._supports_on_and_off:
@@ -168,6 +170,7 @@ class LightTransition(SmartModule):
168
170
  # v3 added max_duration, we default to 60 when it's not available
169
171
  return self._on_state["max_duration"]
170
172
 
173
+ @allow_update_after
171
174
  async def set_turn_on_transition(self, seconds: int):
172
175
  """Set turn on transition in seconds.
173
176
 
@@ -203,6 +206,7 @@ class LightTransition(SmartModule):
203
206
  # v3 added max_duration, we default to 60 when it's not available
204
207
  return self._off_state["max_duration"]
205
208
 
209
+ @allow_update_after
206
210
  async def set_turn_off_transition(self, seconds: int):
207
211
  """Set turn on transition in seconds.
208
212
 
@@ -4,15 +4,10 @@ from __future__ import annotations
4
4
 
5
5
  import logging
6
6
  from enum import Enum
7
- from typing import TYPE_CHECKING
8
7
 
9
8
  from ...feature import Feature
10
9
  from ..smartmodule import SmartModule
11
10
 
12
- if TYPE_CHECKING:
13
- from ..smartdevice import SmartDevice
14
-
15
-
16
11
  _LOGGER = logging.getLogger(__name__)
17
12
 
18
13
 
@@ -31,11 +26,11 @@ class TemperatureControl(SmartModule):
31
26
 
32
27
  REQUIRED_COMPONENT = "temp_control"
33
28
 
34
- def __init__(self, device: SmartDevice, module: str):
35
- super().__init__(device, module)
29
+ def _initialize_features(self):
30
+ """Initialize features after the initial update."""
36
31
  self._add_feature(
37
32
  Feature(
38
- device,
33
+ self._device,
39
34
  id="target_temperature",
40
35
  name="Target temperature",
41
36
  container=self,
@@ -50,7 +45,7 @@ class TemperatureControl(SmartModule):
50
45
  # TODO: this might belong into its own module, temperature_correction?
51
46
  self._add_feature(
52
47
  Feature(
53
- device,
48
+ self._device,
54
49
  id="temperature_offset",
55
50
  name="Temperature offset",
56
51
  container=self,
@@ -65,7 +60,7 @@ class TemperatureControl(SmartModule):
65
60
 
66
61
  self._add_feature(
67
62
  Feature(
68
- device,
63
+ self._device,
69
64
  id="state",
70
65
  name="State",
71
66
  container=self,
@@ -78,7 +73,7 @@ class TemperatureControl(SmartModule):
78
73
 
79
74
  self._add_feature(
80
75
  Feature(
81
- device,
76
+ self._device,
82
77
  id="thermostat_mode",
83
78
  name="Thermostat mode",
84
79
  container=self,
@@ -109,23 +104,24 @@ class TemperatureControl(SmartModule):
109
104
  if self._device.sys_info.get("frost_protection_on", False):
110
105
  return ThermostatState.Off
111
106
 
112
- states = self._device.sys_info["trv_states"]
107
+ states = self.states
113
108
 
114
109
  # If the states is empty, the device is idling
115
110
  if not states:
116
111
  return ThermostatState.Idle
117
112
 
113
+ # Discard known extra states, and report on unknown extra states
114
+ states.discard("low_battery")
118
115
  if len(states) > 1:
119
- _LOGGER.warning(
120
- "Got multiple states (%s), using the first one: %s", states, states[0]
121
- )
116
+ _LOGGER.warning("Got multiple states: %s", states)
122
117
 
123
- state = states[0]
124
- try:
125
- return ThermostatState(state)
126
- except: # noqa: E722
127
- _LOGGER.warning("Got unknown state: %s", state)
128
- return ThermostatState.Unknown
118
+ # Return the first known state
119
+ for state in ThermostatState:
120
+ if state.value in states:
121
+ return state
122
+
123
+ _LOGGER.warning("Got unknown state: %s", states)
124
+ return ThermostatState.Unknown
129
125
 
130
126
  @property
131
127
  def allowed_temperature_range(self) -> tuple[int, int]:
@@ -147,6 +143,11 @@ class TemperatureControl(SmartModule):
147
143
  """Return target temperature."""
148
144
  return self._device.sys_info["target_temp"]
149
145
 
146
+ @property
147
+ def states(self) -> set:
148
+ """Return thermostat states."""
149
+ return set(self._device.sys_info["trv_states"])
150
+
150
151
  async def set_target_temperature(self, target: float):
151
152
  """Set target temperature."""
152
153
  if (
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
+ import time
6
7
  from typing import Any
7
8
 
8
9
  from ..device_type import DeviceType
@@ -46,6 +47,7 @@ class SmartChildDevice(SmartDevice):
46
47
  req.update(mod_query)
47
48
  if req:
48
49
  self._last_update = await self.protocol.query(req)
50
+ self._last_update_time = time.time()
49
51
 
50
52
  @classmethod
51
53
  async def create(cls, parent: SmartDevice, child_info, child_components):
kasa/smart/smartdevice.py CHANGED
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import base64
6
6
  import logging
7
+ import time
7
8
  from collections.abc import Mapping, Sequence
8
9
  from datetime import datetime, timedelta, timezone
9
10
  from typing import Any, cast
@@ -18,6 +19,7 @@ from ..module import Module
18
19
  from ..modulemapping import ModuleMapping, ModuleName
19
20
  from ..smartprotocol import SmartProtocol
20
21
  from .modules import (
22
+ ChildDevice,
21
23
  Cloud,
22
24
  DeviceModule,
23
25
  Firmware,
@@ -35,6 +37,9 @@ _LOGGER = logging.getLogger(__name__)
35
37
  # same issue, homekit perhaps?
36
38
  NON_HUB_PARENT_ONLY_MODULES = [DeviceModule, Time, Firmware, Cloud]
37
39
 
40
+ # Modules that are called as part of the init procedure on first update
41
+ FIRST_UPDATE_MODULES = {DeviceModule, ChildDevice, Cloud}
42
+
38
43
 
39
44
  # Device must go last as the other interfaces also inherit Device
40
45
  # and python needs a consistent method resolution order.
@@ -60,6 +65,7 @@ class SmartDevice(Device):
60
65
  self._parent: SmartDevice | None = None
61
66
  self._children: Mapping[str, SmartDevice] = {}
62
67
  self._last_update = {}
68
+ self._last_update_time: float | None = None
63
69
 
64
70
  async def _initialize_children(self):
65
71
  """Initialize children for power strips."""
@@ -152,19 +158,15 @@ class SmartDevice(Device):
152
158
  if self.credentials is None and self.credentials_hash is None:
153
159
  raise AuthenticationError("Tapo plug requires authentication.")
154
160
 
155
- if self._components_raw is None:
161
+ first_update = self._last_update_time is None
162
+ now = time.time()
163
+ self._last_update_time = now
164
+
165
+ if first_update:
156
166
  await self._negotiate()
157
167
  await self._initialize_modules()
158
168
 
159
- req: dict[str, Any] = {}
160
-
161
- # TODO: this could be optimized by constructing the query only once
162
- for module in self._modules.values():
163
- req.update(module.query())
164
-
165
- self._last_update = resp = await self.protocol.query(req)
166
-
167
- self._info = self._try_get_response(resp, "get_device_info")
169
+ resp = await self._modular_update(first_update, now)
168
170
 
169
171
  # Call child update which will only update module calls, info is updated
170
172
  # from get_child_device_list. update_children only affects hub devices, other
@@ -172,18 +174,12 @@ class SmartDevice(Device):
172
174
  if update_children or self.device_type != DeviceType.Hub:
173
175
  for child in self._children.values():
174
176
  await child.update()
175
- if child_info := self._try_get_response(resp, "get_child_device_list", {}):
177
+ if child_info := self._try_get_response(
178
+ self._last_update, "get_child_device_list", {}
179
+ ):
176
180
  for info in child_info["child_device_list"]:
177
181
  self._children[info["device_id"]]._update_internal_state(info)
178
182
 
179
- # Call handle update for modules that want to update internal data
180
- errors = []
181
- for module_name, module in self._modules.items():
182
- if not self._handle_module_post_update_hook(module):
183
- errors.append(module_name)
184
- for error in errors:
185
- self._modules.pop(error)
186
-
187
183
  for child in self._children.values():
188
184
  errors = []
189
185
  for child_module_name, child_module in child._modules.items():
@@ -197,14 +193,18 @@ class SmartDevice(Device):
197
193
  if not self._features:
198
194
  await self._initialize_features()
199
195
 
200
- _LOGGER.debug("Got an update: %s", self._last_update)
196
+ _LOGGER.debug(
197
+ "Update completed %s: %s",
198
+ self.host,
199
+ self._last_update if first_update else resp,
200
+ )
201
201
 
202
202
  def _handle_module_post_update_hook(self, module: SmartModule) -> bool:
203
203
  try:
204
204
  module._post_update_hook()
205
205
  return True
206
206
  except Exception as ex:
207
- _LOGGER.error(
207
+ _LOGGER.warning(
208
208
  "Error processing %s for device %s, module will be unavailable: %s",
209
209
  module.name,
210
210
  self.host,
@@ -212,6 +212,100 @@ class SmartDevice(Device):
212
212
  )
213
213
  return False
214
214
 
215
+ async def _modular_update(
216
+ self, first_update: bool, update_time: float
217
+ ) -> dict[str, Any]:
218
+ """Update the device with via the module queries."""
219
+ req: dict[str, Any] = {}
220
+ # Keep a track of actual module queries so we can track the time for
221
+ # modules that do not need to be updated frequently
222
+ module_queries: list[SmartModule] = []
223
+ mq = {
224
+ module: query
225
+ for module in self._modules.values()
226
+ if (query := module.query())
227
+ }
228
+ for module, query in mq.items():
229
+ if first_update and module.__class__ in FIRST_UPDATE_MODULES:
230
+ module._last_update_time = update_time
231
+ continue
232
+ if (
233
+ not module.MINIMUM_UPDATE_INTERVAL_SECS
234
+ or not module._last_update_time
235
+ or (update_time - module._last_update_time)
236
+ >= module.MINIMUM_UPDATE_INTERVAL_SECS
237
+ ):
238
+ module_queries.append(module)
239
+ req.update(query)
240
+
241
+ _LOGGER.debug(
242
+ "Querying %s for modules: %s",
243
+ self.host,
244
+ ", ".join(mod.name for mod in module_queries),
245
+ )
246
+
247
+ try:
248
+ resp = await self.protocol.query(req)
249
+ except Exception as ex:
250
+ resp = await self._handle_modular_update_error(
251
+ ex, first_update, ", ".join(mod.name for mod in module_queries), req
252
+ )
253
+
254
+ info_resp = self._last_update if first_update else resp
255
+ self._last_update.update(**resp)
256
+ self._info = self._try_get_response(info_resp, "get_device_info")
257
+
258
+ # Call handle update for modules that want to update internal data
259
+ errors = []
260
+ for module_name, module in self._modules.items():
261
+ if not self._handle_module_post_update_hook(module):
262
+ errors.append(module_name)
263
+ for error in errors:
264
+ self._modules.pop(error)
265
+
266
+ # Set the last update time for modules that had queries made.
267
+ for module in module_queries:
268
+ module._last_update_time = update_time
269
+
270
+ return resp
271
+
272
+ async def _handle_modular_update_error(
273
+ self,
274
+ ex: Exception,
275
+ first_update: bool,
276
+ module_names: str,
277
+ requests: dict[str, Any],
278
+ ) -> dict[str, Any]:
279
+ """Handle an error on calling module update.
280
+
281
+ Will try to call all modules individually
282
+ and any errors such as timeouts will be set as a SmartErrorCode.
283
+ """
284
+ msg_part = "on first update" if first_update else "after first update"
285
+
286
+ _LOGGER.error(
287
+ "Error querying %s for modules '%s' %s: %s",
288
+ self.host,
289
+ module_names,
290
+ msg_part,
291
+ ex,
292
+ )
293
+ responses = {}
294
+ for meth, params in requests.items():
295
+ try:
296
+ resp = await self.protocol.query({meth: params})
297
+ responses[meth] = resp[meth]
298
+ except Exception as iex:
299
+ _LOGGER.error(
300
+ "Error querying %s individually for module query '%s' %s: %s",
301
+ self.host,
302
+ meth,
303
+ msg_part,
304
+ iex,
305
+ )
306
+ responses[meth] = SmartErrorCode.INTERNAL_QUERY_ERROR
307
+ return responses
308
+
215
309
  async def _initialize_modules(self):
216
310
  """Initialize modules based on component negotiation response."""
217
311
  from .smartmodule import SmartModule
@@ -229,8 +323,6 @@ class SmartDevice(Device):
229
323
  skip_parent_only_modules = True
230
324
 
231
325
  for mod in SmartModule.REGISTERED_MODULES.values():
232
- _LOGGER.debug("%s requires %s", mod, mod.REQUIRED_COMPONENT)
233
-
234
326
  if (
235
327
  skip_parent_only_modules and mod in NON_HUB_PARENT_ONLY_MODULES
236
328
  ) or mod.__name__ in child_modules_to_skip:
@@ -240,7 +332,8 @@ class SmartDevice(Device):
240
332
  or self.sys_info.get(mod.REQUIRED_KEY_ON_PARENT) is not None
241
333
  ):
242
334
  _LOGGER.debug(
243
- "Found required %s, adding %s to modules.",
335
+ "Device %s, found required %s, adding %s to modules.",
336
+ self.host,
244
337
  mod.REQUIRED_COMPONENT,
245
338
  mod.__name__,
246
339
  )
kasa/smart/smartmodule.py CHANGED
@@ -3,7 +3,10 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
- from typing import TYPE_CHECKING
6
+ from collections.abc import Awaitable, Callable, Coroutine
7
+ from typing import TYPE_CHECKING, Any
8
+
9
+ from typing_extensions import Concatenate, ParamSpec, TypeVar
7
10
 
8
11
  from ..exceptions import DeviceError, KasaException, SmartErrorCode
9
12
  from ..module import Module
@@ -13,6 +16,27 @@ if TYPE_CHECKING:
13
16
 
14
17
  _LOGGER = logging.getLogger(__name__)
15
18
 
19
+ _T = TypeVar("_T", bound="SmartModule")
20
+ _P = ParamSpec("_P")
21
+
22
+
23
+ def allow_update_after(
24
+ func: Callable[Concatenate[_T, _P], Awaitable[None]],
25
+ ) -> Callable[Concatenate[_T, _P], Coroutine[Any, Any, None]]:
26
+ """Define a wrapper to set _last_update_time to None.
27
+
28
+ This will ensure that a module is updated in the next update cycle after
29
+ a value has been changed.
30
+ """
31
+
32
+ async def _async_wrap(self: _T, *args: _P.args, **kwargs: _P.kwargs) -> None:
33
+ try:
34
+ await func(self, *args, **kwargs)
35
+ finally:
36
+ self._last_update_time = None
37
+
38
+ return _async_wrap
39
+
16
40
 
17
41
  class SmartModule(Module):
18
42
  """Base class for SMART modules."""
@@ -27,9 +51,12 @@ class SmartModule(Module):
27
51
 
28
52
  REGISTERED_MODULES: dict[str, type[SmartModule]] = {}
29
53
 
54
+ MINIMUM_UPDATE_INTERVAL_SECS = 0
55
+
30
56
  def __init__(self, device: SmartDevice, module: str):
31
57
  self._device: SmartDevice
32
58
  super().__init__(device, module)
59
+ self._last_update_time: float | None = None
33
60
 
34
61
  def __init_subclass__(cls, **kwargs):
35
62
  name = getattr(cls, "NAME", cls.__name__)
kasa/smartprotocol.py CHANGED
@@ -73,18 +73,32 @@ class SmartProtocol(BaseProtocol):
73
73
  return await self._execute_query(
74
74
  request, retry_count=retry, iterate_list_pages=True
75
75
  )
76
- except _ConnectionError as sdex:
76
+ except _ConnectionError as ex:
77
+ if retry == 0:
78
+ _LOGGER.debug(
79
+ "Device %s got a connection error, will retry %s times: %s",
80
+ self._host,
81
+ retry_count,
82
+ ex,
83
+ )
77
84
  if retry >= retry_count:
78
85
  _LOGGER.debug("Giving up on %s after %s retries", self._host, retry)
79
- raise sdex
86
+ raise ex
80
87
  continue
81
- except AuthenticationError as auex:
88
+ except AuthenticationError as ex:
82
89
  await self._transport.reset()
83
90
  _LOGGER.debug(
84
- "Unable to authenticate with %s, not retrying", self._host
91
+ "Unable to authenticate with %s, not retrying: %s", self._host, ex
85
92
  )
86
- raise auex
93
+ raise ex
87
94
  except _RetryableError as ex:
95
+ if retry == 0:
96
+ _LOGGER.debug(
97
+ "Device %s got a retryable error, will retry %s times: %s",
98
+ self._host,
99
+ retry_count,
100
+ ex,
101
+ )
88
102
  await self._transport.reset()
89
103
  if retry >= retry_count:
90
104
  _LOGGER.debug("Giving up on %s after %s retries", self._host, retry)
@@ -92,6 +106,13 @@ class SmartProtocol(BaseProtocol):
92
106
  await asyncio.sleep(self.BACKOFF_SECONDS_AFTER_TIMEOUT)
93
107
  continue
94
108
  except TimeoutError as ex:
109
+ if retry == 0:
110
+ _LOGGER.debug(
111
+ "Device %s got a timeout error, will retry %s times: %s",
112
+ self._host,
113
+ retry_count,
114
+ ex,
115
+ )
95
116
  await self._transport.reset()
96
117
  if retry >= retry_count:
97
118
  _LOGGER.debug("Giving up on %s after %s retries", self._host, retry)
@@ -130,20 +151,21 @@ class SmartProtocol(BaseProtocol):
130
151
  self._handle_response_error_code(resp, method, raise_on_error=False)
131
152
  multi_result[method] = resp["result"]
132
153
  return multi_result
133
- for i in range(0, end, step):
154
+
155
+ for batch_num, i in enumerate(range(0, end, step)):
134
156
  requests_step = multi_requests[i : i + step]
135
157
 
136
158
  smart_params = {"requests": requests_step}
137
159
  smart_request = self.get_smart_request(smart_method, smart_params)
160
+ batch_name = f"multi-request-batch-{batch_num+1}-of-{int(end/step)+1}"
138
161
  if debug_enabled:
139
162
  _LOGGER.debug(
140
- "%s multi-request-batch-%s >> %s",
163
+ "%s %s >> %s",
141
164
  self._host,
142
- i + 1,
165
+ batch_name,
143
166
  pf(smart_request),
144
167
  )
145
168
  response_step = await self._transport.send(smart_request)
146
- batch_name = f"multi-request-batch-{i+1}"
147
169
  if debug_enabled:
148
170
  _LOGGER.debug(
149
171
  "%s %s << %s",
@@ -271,7 +293,9 @@ class SmartProtocol(BaseProtocol):
271
293
  try:
272
294
  error_code = SmartErrorCode.from_int(error_code_raw)
273
295
  except ValueError:
274
- _LOGGER.warning("Received unknown error code: %s", error_code_raw)
296
+ _LOGGER.warning(
297
+ "Device %s received unknown error code: %s", self._host, error_code_raw
298
+ )
275
299
  error_code = SmartErrorCode.INTERNAL_UNKNOWN_ERROR
276
300
 
277
301
  if error_code is SmartErrorCode.SUCCESS:
@@ -94,7 +94,7 @@ async def test_temperature_offset(dev):
94
94
  ),
95
95
  pytest.param(
96
96
  ThermostatState.Heating,
97
- [ThermostatState.Heating],
97
+ ["heating"],
98
98
  False,
99
99
  id="heating is heating",
100
100
  ),
@@ -135,3 +135,11 @@ async def test_thermostat_mode_warnings(dev, mode, states, msg, caplog):
135
135
  temp_module.data["trv_states"] = states
136
136
  assert temp_module.mode is mode
137
137
  assert msg in caplog.text
138
+
139
+
140
+ @thermostats_smart
141
+ async def test_thermostat_heating_with_low_battery(dev):
142
+ """Test that mode is reported correctly with extra states."""
143
+ temp_module: TemperatureControl = dev.modules["TemperatureControl"]
144
+ temp_module.data["trv_states"] = ["low_battery", "heating"]
145
+ assert temp_module.mode is ThermostatState.Heating
@@ -3,10 +3,12 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
+ import time
6
7
  from typing import Any, cast
7
8
  from unittest.mock import patch
8
9
 
9
10
  import pytest
11
+ from freezegun.api import FrozenDateTimeFactory
10
12
  from pytest_mock import MockerFixture
11
13
 
12
14
  from kasa import Device, KasaException, Module
@@ -54,6 +56,8 @@ async def test_initial_update(dev: SmartDevice, mocker: MockerFixture):
54
56
  dev._modules = {}
55
57
  dev._features = {}
56
58
  dev._children = {}
59
+ dev._last_update = {}
60
+ dev._last_update_time = None
57
61
 
58
62
  negotiate = mocker.spy(dev, "_negotiate")
59
63
  initialize_modules = mocker.spy(dev, "_initialize_modules")
@@ -109,6 +113,9 @@ async def test_update_module_queries(dev: SmartDevice, mocker: MockerFixture):
109
113
  """Test that the regular update uses queries from all supported modules."""
110
114
  # We need to have some modules initialized by now
111
115
  assert dev._modules
116
+ # Reset last update so all modules will query
117
+ for mod in dev._modules.values():
118
+ mod._last_update_time = None
112
119
 
113
120
  device_queries: dict[SmartDevice, dict[str, Any]] = {}
114
121
  for mod in dev._modules.values():
@@ -139,7 +146,7 @@ async def test_update_module_errors(dev: SmartDevice, mocker: MockerFixture):
139
146
  assert dev._modules
140
147
 
141
148
  critical_modules = {Module.DeviceModule, Module.ChildDevice}
142
- not_disabling_modules = {Module.Firmware, Module.Cloud}
149
+ not_disabling_modules = {Module.Cloud}
143
150
 
144
151
  new_dev = SmartDevice("127.0.0.1", protocol=dev.protocol)
145
152
 
@@ -204,6 +211,123 @@ async def test_update_module_errors(dev: SmartDevice, mocker: MockerFixture):
204
211
  ), f"{modname} present {mod_present} when no_disable {no_disable}"
205
212
 
206
213
 
214
+ @device_smart
215
+ async def test_update_module_update_delays(
216
+ dev: SmartDevice,
217
+ mocker: MockerFixture,
218
+ caplog: pytest.LogCaptureFixture,
219
+ freezer: FrozenDateTimeFactory,
220
+ ):
221
+ """Test that modules that disabled / removed on query failures."""
222
+ # We need to have some modules initialized by now
223
+ assert dev._modules
224
+
225
+ new_dev = SmartDevice("127.0.0.1", protocol=dev.protocol)
226
+ await new_dev.update()
227
+ first_update_time = time.time()
228
+ assert new_dev._last_update_time == first_update_time
229
+ for module in new_dev.modules.values():
230
+ if module.query():
231
+ assert module._last_update_time == first_update_time
232
+
233
+ seconds = 0
234
+ tick = 30
235
+ while seconds <= 180:
236
+ seconds += tick
237
+ freezer.tick(tick)
238
+
239
+ now = time.time()
240
+ await new_dev.update()
241
+ for module in new_dev.modules.values():
242
+ mod_delay = module.MINIMUM_UPDATE_INTERVAL_SECS
243
+ if module.query():
244
+ expected_update_time = (
245
+ now if mod_delay == 0 else now - (seconds % mod_delay)
246
+ )
247
+
248
+ assert (
249
+ module._last_update_time == expected_update_time
250
+ ), f"Expected update time {expected_update_time} after {seconds} seconds for {module.name} with delay {mod_delay} got {module._last_update_time}"
251
+
252
+
253
+ @pytest.mark.parametrize(
254
+ ("first_update"),
255
+ [
256
+ pytest.param(True, id="First update true"),
257
+ pytest.param(False, id="First update false"),
258
+ ],
259
+ )
260
+ @device_smart
261
+ async def test_update_module_query_errors(
262
+ dev: SmartDevice,
263
+ mocker: MockerFixture,
264
+ caplog: pytest.LogCaptureFixture,
265
+ freezer: FrozenDateTimeFactory,
266
+ first_update,
267
+ ):
268
+ """Test that modules that disabled / removed on query failures."""
269
+ # We need to have some modules initialized by now
270
+ assert dev._modules
271
+
272
+ first_update_queries = {"get_device_info", "get_connect_cloud_state"}
273
+
274
+ critical_modules = {Module.DeviceModule, Module.ChildDevice}
275
+ not_disabling_modules = {Module.Cloud}
276
+
277
+ new_dev = SmartDevice("127.0.0.1", protocol=dev.protocol)
278
+ if not first_update:
279
+ await new_dev.update()
280
+ freezer.tick(
281
+ max(module.MINIMUM_UPDATE_INTERVAL_SECS for module in dev._modules.values())
282
+ )
283
+
284
+ module_queries = {
285
+ modname: q
286
+ for modname, module in dev._modules.items()
287
+ if (q := module.query()) and modname not in critical_modules
288
+ }
289
+
290
+ async def _query(request, *args, **kwargs):
291
+ if (
292
+ "component_nego" in request
293
+ or "get_child_device_component_list" in request
294
+ or "control_child" in request
295
+ ):
296
+ return await dev.protocol._query(request, *args, **kwargs)
297
+ if len(request) == 1 and "get_device_info" in request:
298
+ return await dev.protocol._query(request, *args, **kwargs)
299
+
300
+ raise TimeoutError("Dummy timeout")
301
+
302
+ from kasa.smartprotocol import _ChildProtocolWrapper
303
+
304
+ child_protocols = {
305
+ cast(_ChildProtocolWrapper, child.protocol)._device_id: child.protocol
306
+ for child in dev.children
307
+ }
308
+
309
+ async def _child_query(self, request, *args, **kwargs):
310
+ return await child_protocols[self._device_id]._query(request, *args, **kwargs)
311
+
312
+ mocker.patch.object(new_dev.protocol, "query", side_effect=_query)
313
+ # children not created yet so cannot patch.object
314
+ mocker.patch("kasa.smartprotocol._ChildProtocolWrapper.query", new=_child_query)
315
+
316
+ await new_dev.update()
317
+ msg = f"Error querying {new_dev.host} for modules"
318
+ assert msg in caplog.text
319
+ for modname in module_queries:
320
+ no_disable = modname in not_disabling_modules
321
+ mod_present = modname in new_dev._modules
322
+ assert (
323
+ mod_present is no_disable
324
+ ), f"{modname} present {mod_present} when no_disable {no_disable}"
325
+ for mod_query in module_queries[modname]:
326
+ if not first_update or mod_query not in first_update_queries:
327
+ msg = f"Error querying {new_dev.host} individually for module query '{mod_query}"
328
+ assert msg in caplog.text
329
+
330
+
207
331
  async def test_get_modules():
208
332
  """Test getting modules for child and parent modules."""
209
333
  dummy_device = await get_device_for_fixture_protocol(
@@ -66,7 +66,7 @@ async def test_smart_device_unknown_errors(
66
66
  assert res is SmartErrorCode.INTERNAL_UNKNOWN_ERROR
67
67
 
68
68
  send_mock.assert_called_once()
69
- assert f"Received unknown error code: {error_code}" in caplog.text
69
+ assert f"received unknown error code: {error_code}" in caplog.text
70
70
 
71
71
 
72
72
  @pytest.mark.parametrize("error_code", ERRORS, ids=lambda e: e.name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-kasa
3
- Version: 0.7.0.3
3
+ Version: 0.7.0.4
4
4
  Summary: Python API for TP-Link Kasa Smarthome devices
5
5
  Home-page: https://github.com/python-kasa/python-kasa
6
6
  License: GPL-3.0-or-later
@@ -1,5 +1,5 @@
1
1
  kasa/__init__.py,sha256=Hxo9ItTa2noIYRXWVSneK15nDUWdd3fBUcYYJTlC2bM,4454
2
- kasa/aestransport.py,sha256=Wgpv8ijBnwfxzIb7Bc8e3__-CG_vXlL1ispdvnJmi4Q,16446
2
+ kasa/aestransport.py,sha256=RTPwVUz5qddO7xdP3HiDE60I9nthPSlZHxvszOTsP8U,16782
3
3
  kasa/cli.py,sha256=QtmtHhsmoKpk5EwfDOOR4XYNeQF33679aOglH_Umu0c,39268
4
4
  kasa/credentials.py,sha256=SU9O5QjkWsozC7oCMhc2abydmETNjLZrJwv_KJ6fnK4,357
5
5
  kasa/device.py,sha256=RA229EkOoqXFohRiIWqAZ-hgL_HyMaID3OMO-IRINO8,17150
@@ -8,9 +8,9 @@ kasa/device_type.py,sha256=MJW1bVoAcH_MILSW8IBpv3jKRbPWkxmvuWdU-7Ov_D0,744
8
8
  kasa/deviceconfig.py,sha256=F7ObHVaV2iu_X63Azwd8Wxu14i3j_HPrbPZPqsbO9DE,8022
9
9
  kasa/discover.py,sha256=-YSM4z338cGzQN30kXQcq34vEcNBDrqTHAdK4lT54LM,22538
10
10
  kasa/emeterstatus.py,sha256=-F0QAXR13jmfgdzjMjgLUY3LhEWRqceJ8zkB53HIX1Y,2529
11
- kasa/exceptions.py,sha256=Tfvn_EAuiaeyG46dpEFJTA9MbJ9wPKQzAXFMxFH61t8,4161
11
+ kasa/exceptions.py,sha256=Wek1F49MNEsw9xBS7tpzHi92ZeECM7sI_V13RoQ4UoI,4237
12
12
  kasa/feature.py,sha256=TNlaC3CZi1o3fdTune5VT3VQ_4XxExssVakH-t0Xn8k,10036
13
- kasa/httpclient.py,sha256=Jpe8hiL3Fsi6qd8OAJacbVpf6MSXVFtWEmSPJnenzoY,5088
13
+ kasa/httpclient.py,sha256=kiX1huT-Sy0IfwMZkQzDryiyuayf17IoNDxTY69LNwc,5616
14
14
  kasa/interfaces/__init__.py,sha256=ol9ejrJp35NI1EiMvoZyp7jjYsYMr316goEndzikp44,331
15
15
  kasa/interfaces/energy.py,sha256=AWWSlqFe4sOianskJCkm1PqAN6KuYOYb8Ht3B7jxL5E,5999
16
16
  kasa/interfaces/fan.py,sha256=cnT9HpiJrJ9JSrF4nRzb6Ff8OyC1-ZUzW6aIGXQObWc,411
@@ -58,31 +58,31 @@ kasa/smart/modules/autooff.py,sha256=RxtmUTj9dknP92cmsyyvYmCERAanoQyXvSHxOevVNvM
58
58
  kasa/smart/modules/batterysensor.py,sha256=cjdrAa71RFZ88kQ36hzwFV0LfKZ7eHZdx2tH2v5hnPs,1738
59
59
  kasa/smart/modules/brightness.py,sha256=GjQZ6wTRy8bDFBKT_zwMT0XQHIjx88DfxH-AFqmFM2k,2642
60
60
  kasa/smart/modules/childdevice.py,sha256=oxzSEk0uDcxtsTfT0TPPb0otPb9fwKpFObihNVheL64,991
61
- kasa/smart/modules/cloud.py,sha256=t_dS3AGU-3IVLvLBhUX7Xt0zJ-Hsq7OuvSkcKgIYNl8,1348
61
+ kasa/smart/modules/cloud.py,sha256=ashEokQmfRq9NNQQ382OtVzatwaTAR2ncYphuqPJD_4,1386
62
62
  kasa/smart/modules/color.py,sha256=Qr8v0xz1sgKDI6OwdcD5UxJabqBQ1bhMJMH5fPivbI8,2956
63
63
  kasa/smart/modules/colortemperature.py,sha256=fK7SMAfeX__LIoVlLO7aMKOWa52XmpUzR0Aymrb8tRs,2511
64
64
  kasa/smart/modules/contactsensor.py,sha256=wnKkb5yt7OPvdvfFjYlB0_xKsTptviNSQD19UDJQ3sY,1145
65
65
  kasa/smart/modules/devicemodule.py,sha256=3SixQV2wXLf14Z3ZA4poHY93pnWK4XHvmHPLkUfOXWw,780
66
66
  kasa/smart/modules/energy.py,sha256=AFZSc4wpr9HTaYtsOFiyTUVQGPpKRJ0UM17fLdf3H8s,3152
67
67
  kasa/smart/modules/fan.py,sha256=61tPg4UIKN16BgyYqN2rLu9UYcP5q4NN8A2YCB2Zjno,2552
68
- kasa/smart/modules/firmware.py,sha256=PToVbqTWi8zclWs6thH8loug3V0QHaCb-_kxTD14mmE,7582
68
+ kasa/smart/modules/firmware.py,sha256=ApP1TqCV1KVnuAfN6EcM7nAFcAVFUu4ng2APRIhvXWQ,7459
69
69
  kasa/smart/modules/frostprotection.py,sha256=NsNhbvMnuCoUJWGbAWfP7_ODoOiIGISTHHE-Xj9IeNw,1125
70
70
  kasa/smart/modules/humiditysensor.py,sha256=T-jsWVEOSVl6oX_IWvFvl_tCyjdncQjeFi-sxzH07Q4,1755
71
- kasa/smart/modules/led.py,sha256=g9AuNjZ8QDBbtJ-qgHc5coGPONSFjrkBK9UA-n6bk4c,1378
71
+ kasa/smart/modules/led.py,sha256=VaFhMX8MTv3JZ311glm9DhF-6Auy6-gazNvTf5pVjdI,1517
72
72
  kasa/smart/modules/light.py,sha256=3JQ3OUdknnb_hpM62O-2MUcgCR584VqkzI9amjaneIA,5668
73
- kasa/smart/modules/lighteffect.py,sha256=Ki-ioL_sJE_pgURkQupTZwsbi6ulH7ttHJi2Ct4Ou3A,6142
74
- kasa/smart/modules/lightpreset.py,sha256=TFXlCWce9VaXhtHptbbJ52C6QQeUKQj38nzV7ipczFg,5833
75
- kasa/smart/modules/lightstripeffect.py,sha256=vOkt5S0I_NlcOy9Seoo6zrgdLR18YqTXXKx0Q7X3R7o,5548
76
- kasa/smart/modules/lighttransition.py,sha256=XQMH9o6MMMRwqA8jSqk3vBlTCP1R8JqRDnED54Ryuv4,8212
73
+ kasa/smart/modules/lighteffect.py,sha256=VUhL8jV-LyMaoqvkQvw0XmdpCZwoxSYkBDahyjUJ01A,6248
74
+ kasa/smart/modules/lightpreset.py,sha256=-A35EjnFylrriQq93IF_toPYdUU39mKRmzzaVLF-g-w,5915
75
+ kasa/smart/modules/lightstripeffect.py,sha256=iuygSAstKkS5C9pEppVG_vEkAAnNKtXe5Ua_Mc3B8pE,5616
76
+ kasa/smart/modules/lighttransition.py,sha256=0cfm4U-sl2Oir2F1jW9HAWajDudPVsz9q2HOc7D0F50,8342
77
77
  kasa/smart/modules/reportmode.py,sha256=wHabcWLEgSNsh32pK-xn16Aa02anexoqsPdg9VvYWlg,1132
78
- kasa/smart/modules/temperaturecontrol.py,sha256=_9idQNmHRAQA_Rc05jXC4DCfHK4RfoEc-u6HhvGHVr0,5709
78
+ kasa/smart/modules/temperaturecontrol.py,sha256=lz9gY_DQrGblzfmIijofxrWXmzYduDnZc5EBih35Ssk,5822
79
79
  kasa/smart/modules/temperaturesensor.py,sha256=dgqqVJeE03RQ2PRXveLnxC4n-nLz0dQI7nHqrd7ZDBM,2719
80
80
  kasa/smart/modules/time.py,sha256=CITnlRTe0z48DL2KHu18UDeGLKCy629eghYPq3MOHo8,1891
81
81
  kasa/smart/modules/waterleaksensor.py,sha256=yoQtSjM1MO9sMpU2ldtWzHcTPPd7okZNWvjSXmkb4h0,1880
82
- kasa/smart/smartchilddevice.py,sha256=zBstI7ks5XM1wLv5Lcrbj4Pe3jYN0YLxXSwTSKOtKW4,2677
83
- kasa/smart/smartdevice.py,sha256=_sZxwwZaOHTiDyZZ6F-XZTLeq93OapMW8xi8RG1TBmQ,22994
84
- kasa/smart/smartmodule.py,sha256=VVNFFRQqJb4ZOn855FWkPqDOeCPDVX_-0vNuIOb5J-8,4351
85
- kasa/smartprotocol.py,sha256=OdTTZmKLamjLmoV3zNqXeSqCb7fDtKQVkJn3ll2Yh5Q,16943
82
+ kasa/smart/smartchilddevice.py,sha256=rsyIiOWHqwYanhkfkrhxKmXhe8s41mwpI5DrJHan8c4,2738
83
+ kasa/smart/smartdevice.py,sha256=HdeQHJK5u6JKlVJD2IJR7TKiYR7fOh2L7mfMKUtb0Do,26176
84
+ kasa/smart/smartmodule.py,sha256=dNfSVt2UHmq8jWYKb-1GAnYjC_w2N4k-SNor0_vkZkY,5176
85
+ kasa/smartprotocol.py,sha256=1b2xJpp6SK5qE_gEfoVcQYP20b4R1FfeshPKMqHbAic,17850
86
86
  kasa/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  kasa/tests/conftest.py,sha256=SEMjGkposNARLaU2DZO__NBkZmNIn3A-CXJuYIrRk9Q,2791
88
88
  kasa/tests/device_fixtures.py,sha256=p29ye1Q-HjgZERiRXIPk8ik_YNaBD9MhIuNuJsqc-0I,13576
@@ -216,7 +216,7 @@ kasa/tests/smart/modules/test_light_effect.py,sha256=QRep7CVUkN7HtEqswN8Ef2FExaX
216
216
  kasa/tests/smart/modules/test_light_strip_effect.py,sha256=1iqB-QGfO70kmULk6k-Jl59ChjlkbUM49gLM26dwNRo,3303
217
217
  kasa/tests/smart/modules/test_lighttransition.py,sha256=aUv_ke3ZoB8mVG1WZ6TiKPo1TznjGxOFndGtzvnCDFI,2948
218
218
  kasa/tests/smart/modules/test_temperature.py,sha256=MJy4T5HSKl0tzgLADvTS1P2V9-Kq6skOEBlb6fVvt8I,1361
219
- kasa/tests/smart/modules/test_temperaturecontrol.py,sha256=_g7WAp1dkXWWP_8g633Z_LzgEdYDr1xW_XHSg96Pe7k,4145
219
+ kasa/tests/smart/modules/test_temperaturecontrol.py,sha256=BwXj_jYJh9jGuRi-MAWgkMUufIM9RYsqF2JqiX7JE1g,4466
220
220
  kasa/tests/smart/modules/test_waterleak.py,sha256=IeMts3JTj84npChuP3A0sjqt50ZwuhroZOgsYqtN4CU,1156
221
221
  kasa/tests/test_aestransport.py,sha256=aZATZmggbpQu2nIIE2UVw7NZZkuKsEt_WPHRbFfUp_o,18445
222
222
  kasa/tests/test_bulb.py,sha256=SzIPESncYYz2Ov_wo5HauwvEcv-ruSdV_4NxGorBYj0,11794
@@ -238,13 +238,13 @@ kasa/tests/test_lightstrip.py,sha256=GvjrFyWP8A5UahrHDMCetmLzfZKWe1R8jWBdQf3tWI0
238
238
  kasa/tests/test_plug.py,sha256=GOfU-mVSSPuakHoATbg5iJVVMbqGZl6ZCrWSpqshAkw,1859
239
239
  kasa/tests/test_protocol.py,sha256=eHkr9iF2SnlWnyxzb3ECS68r53GBK6Z1SW37G8QHSv8,19578
240
240
  kasa/tests/test_readme_examples.py,sha256=gU19c-M-PkNU2UD-JR4WnXWY3jWVr1Ygy2kaJriDJH4,6934
241
- kasa/tests/test_smartdevice.py,sha256=p1fKvZKmXLT8Idubt2BD8oO2Wn0Y2H8CdRKn7Ft4kV8,10236
242
- kasa/tests/test_smartprotocol.py,sha256=eM9w1Z8x13hA5p_jQyHY5r9uNDFvFIgINpslOQYlbiA,14270
241
+ kasa/tests/test_smartdevice.py,sha256=dM15HXZW6HiFYy8YYuRJnlfKImcWskpk1T8XqVmh5r4,14601
242
+ kasa/tests/test_smartprotocol.py,sha256=p7RJF3SnplHUoJiqfRl1LphykRBFk65zjtqfSr9xz7Q,14270
243
243
  kasa/tests/test_strip.py,sha256=v7-fDl0DTCIxC7Otd8GrAmm_WVkJDqrzBEJ7Yvx9yA0,5017
244
244
  kasa/tests/test_usage.py,sha256=ypM6O_KEpmI3Mw9FRPf045S-FefOKqpM-BF0px6ca6M,2331
245
245
  kasa/xortransport.py,sha256=nuQqClJIgfSt485WCxkw-vNwrORkmoCy-X-xfJiBwOY,8533
246
- python_kasa-0.7.0.3.dist-info/LICENSE,sha256=Klt9aEsei738epLgYqeikhpdBWwMvU1VAli14Bxlc5c,33218
247
- python_kasa-0.7.0.3.dist-info/METADATA,sha256=oZvCC82wJNrkk9CsTpvwhgwEnLL_Ydjc2-eldxwrVbg,11516
248
- python_kasa-0.7.0.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
249
- python_kasa-0.7.0.3.dist-info/entry_points.txt,sha256=RlTlZyXOxJ_r2Ap7lpuPAWyYUud9RfVBnOklBvUKPVA,37
250
- python_kasa-0.7.0.3.dist-info/RECORD,,
246
+ python_kasa-0.7.0.4.dist-info/LICENSE,sha256=Klt9aEsei738epLgYqeikhpdBWwMvU1VAli14Bxlc5c,33218
247
+ python_kasa-0.7.0.4.dist-info/METADATA,sha256=H_Rkl0gSaUG0NLYXufMV36F-9KUcHTdf5KYXz-A8_s4,11516
248
+ python_kasa-0.7.0.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
249
+ python_kasa-0.7.0.4.dist-info/entry_points.txt,sha256=RlTlZyXOxJ_r2Ap7lpuPAWyYUud9RfVBnOklBvUKPVA,37
250
+ python_kasa-0.7.0.4.dist-info/RECORD,,