python-kasa 0.7.4__py3-none-any.whl → 0.7.5__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.
Files changed (38) hide show
  1. kasa/cachedzoneinfo.py +28 -0
  2. kasa/cli/device.py +1 -1
  3. kasa/device.py +7 -3
  4. kasa/device_factory.py +2 -2
  5. kasa/discover.py +2 -2
  6. kasa/iot/iotdevice.py +18 -10
  7. kasa/iot/iotstrip.py +12 -5
  8. kasa/iot/iottimezone.py +156 -0
  9. kasa/iot/modules/ambientlight.py +3 -3
  10. kasa/iot/modules/cloud.py +3 -3
  11. kasa/iot/modules/emeter.py +1 -1
  12. kasa/iot/modules/light.py +1 -1
  13. kasa/iot/modules/lightpreset.py +1 -1
  14. kasa/iot/modules/time.py +16 -5
  15. kasa/klaptransport.py +0 -1
  16. kasa/module.py +1 -1
  17. kasa/smart/modules/cloud.py +3 -9
  18. kasa/smart/modules/color.py +3 -8
  19. kasa/smart/modules/contactsensor.py +3 -8
  20. kasa/smart/modules/devicemodule.py +1 -1
  21. kasa/smart/modules/fan.py +4 -10
  22. kasa/smart/modules/humiditysensor.py +4 -9
  23. kasa/smart/modules/light.py +1 -1
  24. kasa/smart/modules/lighteffect.py +1 -1
  25. kasa/smart/modules/lightpreset.py +1 -1
  26. kasa/smart/modules/lighttransition.py +1 -1
  27. kasa/smart/modules/reportmode.py +3 -8
  28. kasa/smart/modules/temperaturesensor.py +7 -10
  29. kasa/smart/modules/time.py +28 -14
  30. kasa/smart/modules/waterleaksensor.py +4 -8
  31. kasa/smart/smartchilddevice.py +1 -1
  32. kasa/smart/smartdevice.py +23 -11
  33. kasa/smart/smartmodule.py +3 -3
  34. {python_kasa-0.7.4.dist-info → python_kasa-0.7.5.dist-info}/METADATA +2 -1
  35. {python_kasa-0.7.4.dist-info → python_kasa-0.7.5.dist-info}/RECORD +38 -36
  36. {python_kasa-0.7.4.dist-info → python_kasa-0.7.5.dist-info}/WHEEL +0 -0
  37. {python_kasa-0.7.4.dist-info → python_kasa-0.7.5.dist-info}/entry_points.txt +0 -0
  38. {python_kasa-0.7.4.dist-info → python_kasa-0.7.5.dist-info}/licenses/LICENSE +0 -0
kasa/cachedzoneinfo.py ADDED
@@ -0,0 +1,28 @@
1
+ """Module for caching ZoneInfos."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import asyncio
6
+
7
+ from zoneinfo import ZoneInfo
8
+
9
+
10
+ class CachedZoneInfo(ZoneInfo):
11
+ """Cache ZoneInfo objects."""
12
+
13
+ _cache: dict[str, ZoneInfo] = {}
14
+
15
+ @classmethod
16
+ async def get_cached_zone_info(cls, time_zone_str: str) -> ZoneInfo:
17
+ """Get a cached zone info object."""
18
+ if cached := cls._cache.get(time_zone_str):
19
+ return cached
20
+ loop = asyncio.get_running_loop()
21
+ zinfo = await loop.run_in_executor(None, _get_zone_info, time_zone_str)
22
+ cls._cache[time_zone_str] = zinfo
23
+ return zinfo
24
+
25
+
26
+ def _get_zone_info(time_zone_str: str) -> ZoneInfo:
27
+ """Get a time zone object for the given time zone string."""
28
+ return ZoneInfo(time_zone_str)
kasa/cli/device.py CHANGED
@@ -40,7 +40,7 @@ async def state(ctx, dev: Device):
40
40
  echo(f"Port: {dev.port}")
41
41
  echo(f"Device state: {dev.is_on}")
42
42
 
43
- echo(f"Time: {dev.time} (tz: {dev.timezone}")
43
+ echo(f"Time: {dev.time} (tz: {dev.timezone})")
44
44
  echo(f"Hardware: {dev.hw_info['hw_ver']}")
45
45
  echo(f"Software: {dev.hw_info['sw_ver']}")
46
46
  echo(f"MAC (rssi): {dev.mac} ({dev.rssi})")
kasa/device.py CHANGED
@@ -109,7 +109,7 @@ import logging
109
109
  from abc import ABC, abstractmethod
110
110
  from collections.abc import Mapping, Sequence
111
111
  from dataclasses import dataclass
112
- from datetime import datetime
112
+ from datetime import datetime, tzinfo
113
113
  from typing import TYPE_CHECKING, Any
114
114
  from warnings import warn
115
115
 
@@ -377,7 +377,7 @@ class Device(ABC):
377
377
 
378
378
  @property
379
379
  @abstractmethod
380
- def timezone(self) -> dict:
380
+ def timezone(self) -> tzinfo:
381
381
  """Return the timezone and time_difference."""
382
382
 
383
383
  @property
@@ -435,7 +435,11 @@ class Device(ABC):
435
435
  @property
436
436
  @abstractmethod
437
437
  def on_since(self) -> datetime | None:
438
- """Return the time that the device was turned on or None if turned off."""
438
+ """Return the time that the device was turned on or None if turned off.
439
+
440
+ This returns a cached value if the device reported value difference is under
441
+ five seconds to avoid device-caused jitter.
442
+ """
439
443
 
440
444
  @abstractmethod
441
445
  async def wifi_scan(self) -> list[WifiNetwork]:
kasa/device_factory.py CHANGED
@@ -32,8 +32,8 @@ from .xortransport import XorTransport
32
32
 
33
33
  _LOGGER = logging.getLogger(__name__)
34
34
 
35
- GET_SYSINFO_QUERY = {
36
- "system": {"get_sysinfo": None},
35
+ GET_SYSINFO_QUERY: dict[str, dict[str, dict]] = {
36
+ "system": {"get_sysinfo": {}},
37
37
  }
38
38
 
39
39
 
kasa/discover.py CHANGED
@@ -296,8 +296,8 @@ class Discover:
296
296
 
297
297
  DISCOVERY_PORT = 9999
298
298
 
299
- DISCOVERY_QUERY = {
300
- "system": {"get_sysinfo": None},
299
+ DISCOVERY_QUERY: dict[str, dict[str, dict]] = {
300
+ "system": {"get_sysinfo": {}},
301
301
  }
302
302
 
303
303
  DISCOVERY_PORT_2 = 20002
kasa/iot/iotdevice.py CHANGED
@@ -18,7 +18,7 @@ import functools
18
18
  import inspect
19
19
  import logging
20
20
  from collections.abc import Mapping, Sequence
21
- from datetime import datetime, timedelta, timezone
21
+ from datetime import datetime, timedelta, tzinfo
22
22
  from typing import TYPE_CHECKING, Any, cast
23
23
 
24
24
  from ..device import Device, WifiNetwork
@@ -181,6 +181,7 @@ class IotDevice(Device):
181
181
  self._legacy_features: set[str] = set()
182
182
  self._children: Mapping[str, IotDevice] = {}
183
183
  self._modules: dict[str | ModuleName[Module], IotModule] = {}
184
+ self._on_since: datetime | None = None
184
185
 
185
186
  @property
186
187
  def children(self) -> Sequence[IotDevice]:
@@ -207,6 +208,8 @@ class IotDevice(Device):
207
208
  def _create_request(
208
209
  self, target: str, cmd: str, arg: dict | None = None, child_ids=None
209
210
  ):
211
+ if arg is None:
212
+ arg = {}
210
213
  request: dict[str, Any] = {target: {cmd: arg}}
211
214
  if child_ids is not None:
212
215
  request = {"context": {"child_ids": child_ids}, target: {cmd: arg}}
@@ -296,7 +299,7 @@ class IotDevice(Device):
296
299
 
297
300
  self._set_sys_info(self._last_update["system"]["get_sysinfo"])
298
301
  for module in self._modules.values():
299
- module._post_update_hook()
302
+ await module._post_update_hook()
300
303
 
301
304
  if not self._features:
302
305
  await self._initialize_features()
@@ -461,7 +464,7 @@ class IotDevice(Device):
461
464
 
462
465
  @property
463
466
  @requires_update
464
- def timezone(self) -> dict:
467
+ def timezone(self) -> tzinfo:
465
468
  """Return the current timezone."""
466
469
  return self.modules[Module.IotTime].timezone
467
470
 
@@ -592,18 +595,23 @@ class IotDevice(Device):
592
595
  @property # type: ignore
593
596
  @requires_update
594
597
  def on_since(self) -> datetime | None:
595
- """Return pretty-printed on-time, or None if not available."""
596
- if "on_time" not in self._sys_info:
597
- return None
598
+ """Return the time that the device was turned on or None if turned off.
598
599
 
599
- if self.is_off:
600
+ This returns a cached value if the device reported value difference is under
601
+ five seconds to avoid device-caused jitter.
602
+ """
603
+ if self.is_off or "on_time" not in self._sys_info:
604
+ self._on_since = None
600
605
  return None
601
606
 
602
607
  on_time = self._sys_info["on_time"]
603
608
 
604
- return datetime.now(timezone.utc).astimezone().replace(
605
- microsecond=0
606
- ) - timedelta(seconds=on_time)
609
+ on_since = self.time - timedelta(seconds=on_time)
610
+ if not self._on_since or timedelta(
611
+ seconds=0
612
+ ) < on_since - self._on_since > timedelta(seconds=5):
613
+ self._on_since = on_since
614
+ return self._on_since
607
615
 
608
616
  @property # type: ignore
609
617
  @requires_update
kasa/iot/iotstrip.py CHANGED
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import logging
6
6
  from collections import defaultdict
7
- from datetime import datetime, timedelta, timezone
7
+ from datetime import datetime, timedelta
8
8
  from typing import Any
9
9
 
10
10
  from ..device_type import DeviceType
@@ -318,6 +318,7 @@ class IotStripPlug(IotPlug):
318
318
  self._set_sys_info(parent.sys_info)
319
319
  self._device_type = DeviceType.StripSocket
320
320
  self.protocol = parent.protocol # Must use the same connection as the parent
321
+ self._on_since: datetime | None = None
321
322
 
322
323
  async def _initialize_modules(self):
323
324
  """Initialize modules not added in init."""
@@ -372,7 +373,7 @@ class IotStripPlug(IotPlug):
372
373
  """
373
374
  await self._modular_update({})
374
375
  for module in self._modules.values():
375
- module._post_update_hook()
376
+ await module._post_update_hook()
376
377
 
377
378
  if not self._features:
378
379
  await self._initialize_features()
@@ -438,14 +439,20 @@ class IotStripPlug(IotPlug):
438
439
  def on_since(self) -> datetime | None:
439
440
  """Return on-time, if available."""
440
441
  if self.is_off:
442
+ self._on_since = None
441
443
  return None
442
444
 
443
445
  info = self._get_child_info()
444
446
  on_time = info["on_time"]
445
447
 
446
- return datetime.now(timezone.utc).astimezone().replace(
447
- microsecond=0
448
- ) - timedelta(seconds=on_time)
448
+ time = self._parent.time
449
+
450
+ on_since = time - timedelta(seconds=on_time)
451
+ if not self._on_since or timedelta(
452
+ seconds=0
453
+ ) < on_since - self._on_since > timedelta(seconds=5):
454
+ self._on_since = on_since
455
+ return self._on_since
449
456
 
450
457
  @property # type: ignore
451
458
  @requires_update
@@ -0,0 +1,156 @@
1
+ """Module for io device timezone lookups."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ from datetime import datetime, tzinfo
7
+
8
+ from ..cachedzoneinfo import CachedZoneInfo
9
+
10
+ _LOGGER = logging.getLogger(__name__)
11
+
12
+
13
+ async def get_timezone(index: int) -> tzinfo:
14
+ """Get the timezone from the index."""
15
+ if index > 109:
16
+ _LOGGER.error(
17
+ "Unexpected index %s not configured as a timezone, defaulting to UTC", index
18
+ )
19
+ return await CachedZoneInfo.get_cached_zone_info("Etc/UTC")
20
+
21
+ name = TIMEZONE_INDEX[index]
22
+ return await CachedZoneInfo.get_cached_zone_info(name)
23
+
24
+
25
+ async def get_timezone_index(name: str) -> int:
26
+ """Return the iot firmware index for a valid IANA timezone key."""
27
+ rev = {val: key for key, val in TIMEZONE_INDEX.items()}
28
+ if name in rev:
29
+ return rev[name]
30
+
31
+ # Try to find a supported timezone matching dst true/false
32
+ zone = await CachedZoneInfo.get_cached_zone_info(name)
33
+ now = datetime.now()
34
+ winter = datetime(now.year, 1, 1, 12)
35
+ summer = datetime(now.year, 7, 1, 12)
36
+ for i in range(110):
37
+ configured_zone = await get_timezone(i)
38
+ if zone.utcoffset(winter) == configured_zone.utcoffset(
39
+ winter
40
+ ) and zone.utcoffset(summer) == configured_zone.utcoffset(summer):
41
+ return i
42
+ raise ValueError("Device does not support timezone %s", name)
43
+
44
+
45
+ TIMEZONE_INDEX = {
46
+ 0: "Etc/GMT+12",
47
+ 1: "Pacific/Samoa",
48
+ 2: "US/Hawaii",
49
+ 3: "US/Alaska",
50
+ 4: "Mexico/BajaNorte",
51
+ 5: "Etc/GMT+8",
52
+ 6: "PST8PDT",
53
+ 7: "US/Arizona",
54
+ 8: "America/Mazatlan",
55
+ 9: "MST",
56
+ 10: "MST7MDT",
57
+ 11: "Mexico/General",
58
+ 12: "Etc/GMT+6",
59
+ 13: "CST6CDT",
60
+ 14: "America/Monterrey",
61
+ 15: "Canada/Saskatchewan",
62
+ 16: "America/Bogota",
63
+ 17: "Etc/GMT+5",
64
+ 18: "EST",
65
+ 19: "America/Indiana/Indianapolis",
66
+ 20: "America/Caracas",
67
+ 21: "America/Asuncion",
68
+ 22: "Etc/GMT+4",
69
+ 23: "Canada/Atlantic",
70
+ 24: "America/Cuiaba",
71
+ 25: "Brazil/West",
72
+ 26: "America/Santiago",
73
+ 27: "Canada/Newfoundland",
74
+ 28: "America/Sao_Paulo",
75
+ 29: "America/Argentina/Buenos_Aires",
76
+ 30: "America/Cayenne",
77
+ 31: "America/Miquelon",
78
+ 32: "America/Montevideo",
79
+ 33: "Chile/Continental",
80
+ 34: "Etc/GMT+2",
81
+ 35: "Atlantic/Azores",
82
+ 36: "Atlantic/Cape_Verde",
83
+ 37: "Africa/Casablanca",
84
+ 38: "UCT",
85
+ 39: "GB",
86
+ 40: "Africa/Monrovia",
87
+ 41: "Europe/Amsterdam",
88
+ 42: "Europe/Belgrade",
89
+ 43: "Europe/Brussels",
90
+ 44: "Europe/Sarajevo",
91
+ 45: "Africa/Lagos",
92
+ 46: "Africa/Windhoek",
93
+ 47: "Asia/Amman",
94
+ 48: "Europe/Athens",
95
+ 49: "Asia/Beirut",
96
+ 50: "Africa/Cairo",
97
+ 51: "Asia/Damascus",
98
+ 52: "EET",
99
+ 53: "Africa/Harare",
100
+ 54: "Europe/Helsinki",
101
+ 55: "Asia/Istanbul",
102
+ 56: "Asia/Jerusalem",
103
+ 57: "Europe/Kaliningrad",
104
+ 58: "Africa/Tripoli",
105
+ 59: "Asia/Baghdad",
106
+ 60: "Asia/Kuwait",
107
+ 61: "Europe/Minsk",
108
+ 62: "Europe/Moscow",
109
+ 63: "Africa/Nairobi",
110
+ 64: "Asia/Tehran",
111
+ 65: "Asia/Muscat",
112
+ 66: "Asia/Baku",
113
+ 67: "Europe/Samara",
114
+ 68: "Indian/Mauritius",
115
+ 69: "Asia/Tbilisi",
116
+ 70: "Asia/Yerevan",
117
+ 71: "Asia/Kabul",
118
+ 72: "Asia/Ashgabat",
119
+ 73: "Asia/Yekaterinburg",
120
+ 74: "Asia/Karachi",
121
+ 75: "Asia/Kolkata",
122
+ 76: "Asia/Colombo",
123
+ 77: "Asia/Kathmandu",
124
+ 78: "Asia/Almaty",
125
+ 79: "Asia/Dhaka",
126
+ 80: "Asia/Novosibirsk",
127
+ 81: "Asia/Rangoon",
128
+ 82: "Asia/Bangkok",
129
+ 83: "Asia/Krasnoyarsk",
130
+ 84: "Asia/Chongqing",
131
+ 85: "Asia/Irkutsk",
132
+ 86: "Asia/Singapore",
133
+ 87: "Australia/Perth",
134
+ 88: "Asia/Taipei",
135
+ 89: "Asia/Ulaanbaatar",
136
+ 90: "Asia/Tokyo",
137
+ 91: "Asia/Seoul",
138
+ 92: "Asia/Yakutsk",
139
+ 93: "Australia/Adelaide",
140
+ 94: "Australia/Darwin",
141
+ 95: "Australia/Brisbane",
142
+ 96: "Australia/Canberra",
143
+ 97: "Pacific/Guam",
144
+ 98: "Australia/Hobart",
145
+ 99: "Antarctica/DumontDUrville",
146
+ 100: "Asia/Magadan",
147
+ 101: "Asia/Srednekolymsk",
148
+ 102: "Etc/GMT-11",
149
+ 103: "Asia/Anadyr",
150
+ 104: "Pacific/Auckland",
151
+ 105: "Etc/GMT-12",
152
+ 106: "Pacific/Fiji",
153
+ 107: "Etc/GMT-13",
154
+ 108: "Pacific/Apia",
155
+ 109: "Etc/GMT-14",
156
+ }
@@ -16,11 +16,11 @@ from ..iotmodule import IotModule, merge
16
16
  class AmbientLight(IotModule):
17
17
  """Implements ambient light controls for the motion sensor."""
18
18
 
19
- def __init__(self, device, module):
20
- super().__init__(device, module)
19
+ def _initialize_features(self):
20
+ """Initialize features after the initial update."""
21
21
  self._add_feature(
22
22
  Feature(
23
- device=device,
23
+ device=self._device,
24
24
  container=self,
25
25
  id="ambient_light",
26
26
  name="Ambient Light",
kasa/iot/modules/cloud.py CHANGED
@@ -24,11 +24,11 @@ class CloudInfo(BaseModel):
24
24
  class Cloud(IotModule):
25
25
  """Module implementing support for cloud services."""
26
26
 
27
- def __init__(self, device, module):
28
- super().__init__(device, module)
27
+ def _initialize_features(self):
28
+ """Initialize features after the initial update."""
29
29
  self._add_feature(
30
30
  Feature(
31
- device=device,
31
+ device=self._device,
32
32
  container=self,
33
33
  id="cloud_connection",
34
34
  name="Cloud connection",
@@ -12,7 +12,7 @@ from .usage import Usage
12
12
  class Emeter(Usage, EnergyInterface):
13
13
  """Emeter module."""
14
14
 
15
- def _post_update_hook(self) -> None:
15
+ async def _post_update_hook(self) -> None:
16
16
  self._supported = EnergyInterface.ModuleFeature.PERIODIC_STATS
17
17
  if (
18
18
  "voltage_mv" in self.data["get_realtime"]
kasa/iot/modules/light.py CHANGED
@@ -239,7 +239,7 @@ class Light(IotModule, LightInterface):
239
239
  """Return the current light state."""
240
240
  return self._light_state
241
241
 
242
- def _post_update_hook(self) -> None:
242
+ async def _post_update_hook(self) -> None:
243
243
  if self._device.is_on is False:
244
244
  state = LightState(light_on=False)
245
245
  else:
@@ -41,7 +41,7 @@ class LightPreset(IotModule, LightPresetInterface):
41
41
  _presets: dict[str, IotLightPreset]
42
42
  _preset_list: list[str]
43
43
 
44
- def _post_update_hook(self):
44
+ async def _post_update_hook(self):
45
45
  """Update the internal presets."""
46
46
  self._presets = {
47
47
  f"Light preset {index+1}": IotLightPreset(**vals)
kasa/iot/modules/time.py CHANGED
@@ -1,14 +1,19 @@
1
1
  """Provides the current time and timezone information."""
2
2
 
3
- from datetime import datetime
3
+ from __future__ import annotations
4
+
5
+ from datetime import datetime, timezone, tzinfo
4
6
 
5
7
  from ...exceptions import KasaException
6
8
  from ..iotmodule import IotModule, merge
9
+ from ..iottimezone import get_timezone
7
10
 
8
11
 
9
12
  class Time(IotModule):
10
13
  """Implements the timezone settings."""
11
14
 
15
+ _timezone: tzinfo = timezone.utc
16
+
12
17
  def query(self):
13
18
  """Request time and timezone."""
14
19
  q = self.query_for_command("get_time")
@@ -16,24 +21,30 @@ class Time(IotModule):
16
21
  merge(q, self.query_for_command("get_timezone"))
17
22
  return q
18
23
 
24
+ async def _post_update_hook(self):
25
+ """Perform actions after a device update."""
26
+ if res := self.data.get("get_timezone"):
27
+ self._timezone = await get_timezone(res.get("index"))
28
+
19
29
  @property
20
30
  def time(self) -> datetime:
21
31
  """Return current device time."""
22
32
  res = self.data["get_time"]
23
- return datetime(
33
+ time = datetime(
24
34
  res["year"],
25
35
  res["month"],
26
36
  res["mday"],
27
37
  res["hour"],
28
38
  res["min"],
29
39
  res["sec"],
40
+ tzinfo=self.timezone,
30
41
  )
42
+ return time
31
43
 
32
44
  @property
33
- def timezone(self):
45
+ def timezone(self) -> tzinfo:
34
46
  """Return current timezone."""
35
- res = self.data["get_timezone"]
36
- return res
47
+ return self._timezone
37
48
 
38
49
  async def get_time(self):
39
50
  """Return current device time."""
kasa/klaptransport.py CHANGED
@@ -88,7 +88,6 @@ class KlapTransport(BaseTransport):
88
88
  """
89
89
 
90
90
  DEFAULT_PORT: int = 80
91
- DISCOVERY_QUERY = {"system": {"get_sysinfo": None}}
92
91
  SESSION_COOKIE_NAME = "TP_SESSIONID"
93
92
  TIMEOUT_COOKIE_NAME = "TIMEOUT"
94
93
 
kasa/module.py CHANGED
@@ -155,7 +155,7 @@ class Module(ABC):
155
155
  children's modules.
156
156
  """
157
157
 
158
- def _post_update_hook(self): # noqa: B027
158
+ async def _post_update_hook(self): # noqa: B027
159
159
  """Perform actions after a device update.
160
160
 
161
161
  This can be implemented if a module needs to perform actions each time
@@ -2,14 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING
6
-
7
5
  from ...feature import Feature
8
6
  from ..smartmodule import SmartModule
9
7
 
10
- if TYPE_CHECKING:
11
- from ..smartdevice import SmartDevice
12
-
13
8
 
14
9
  class Cloud(SmartModule):
15
10
  """Implementation of cloud module."""
@@ -18,12 +13,11 @@ class Cloud(SmartModule):
18
13
  REQUIRED_COMPONENT = "cloud_connect"
19
14
  MINIMUM_UPDATE_INTERVAL_SECS = 60
20
15
 
21
- def __init__(self, device: SmartDevice, module: str):
22
- super().__init__(device, module)
23
-
16
+ def _initialize_features(self):
17
+ """Initialize features after the initial update."""
24
18
  self._add_feature(
25
19
  Feature(
26
- device,
20
+ self._device,
27
21
  id="cloud_connection",
28
22
  name="Cloud connection",
29
23
  container=self,
@@ -2,26 +2,21 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING
6
-
7
5
  from ...feature import Feature
8
6
  from ...interfaces.light import HSV
9
7
  from ..smartmodule import SmartModule
10
8
 
11
- if TYPE_CHECKING:
12
- from ..smartdevice import SmartDevice
13
-
14
9
 
15
10
  class Color(SmartModule):
16
11
  """Implementation of color module."""
17
12
 
18
13
  REQUIRED_COMPONENT = "color"
19
14
 
20
- def __init__(self, device: SmartDevice, module: str):
21
- super().__init__(device, module)
15
+ def _initialize_features(self):
16
+ """Initialize features after the initial update."""
22
17
  self._add_feature(
23
18
  Feature(
24
- device,
19
+ self._device,
25
20
  "hsv",
26
21
  "HSV",
27
22
  container=self,
@@ -2,14 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING
6
-
7
5
  from ...feature import Feature
8
6
  from ..smartmodule import SmartModule
9
7
 
10
- if TYPE_CHECKING:
11
- from ..smartdevice import SmartDevice
12
-
13
8
 
14
9
  class ContactSensor(SmartModule):
15
10
  """Implementation of contact sensor module."""
@@ -17,11 +12,11 @@ class ContactSensor(SmartModule):
17
12
  REQUIRED_COMPONENT = None # we depend on availability of key
18
13
  REQUIRED_KEY_ON_PARENT = "open"
19
14
 
20
- def __init__(self, device: SmartDevice, module: str):
21
- super().__init__(device, module)
15
+ def _initialize_features(self):
16
+ """Initialize features after the initial update."""
22
17
  self._add_feature(
23
18
  Feature(
24
- device,
19
+ self._device,
25
20
  id="is_open",
26
21
  name="Open",
27
22
  container=self,
@@ -10,7 +10,7 @@ class DeviceModule(SmartModule):
10
10
 
11
11
  REQUIRED_COMPONENT = "device"
12
12
 
13
- def _post_update_hook(self):
13
+ async def _post_update_hook(self):
14
14
  """Perform actions after a device update.
15
15
 
16
16
  Overrides the default behaviour to disable a module if the query returns
kasa/smart/modules/fan.py CHANGED
@@ -2,27 +2,21 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING
6
-
7
5
  from ...feature import Feature
8
6
  from ...interfaces.fan import Fan as FanInterface
9
7
  from ..smartmodule import SmartModule
10
8
 
11
- if TYPE_CHECKING:
12
- from ..smartdevice import SmartDevice
13
-
14
9
 
15
10
  class Fan(SmartModule, FanInterface):
16
11
  """Implementation of fan_control module."""
17
12
 
18
13
  REQUIRED_COMPONENT = "fan_control"
19
14
 
20
- def __init__(self, device: SmartDevice, module: str):
21
- super().__init__(device, module)
22
-
15
+ def _initialize_features(self):
16
+ """Initialize features after the initial update."""
23
17
  self._add_feature(
24
18
  Feature(
25
- device,
19
+ self._device,
26
20
  id="fan_speed_level",
27
21
  name="Fan speed level",
28
22
  container=self,
@@ -36,7 +30,7 @@ class Fan(SmartModule, FanInterface):
36
30
  )
37
31
  self._add_feature(
38
32
  Feature(
39
- device,
33
+ self._device,
40
34
  id="fan_sleep_mode",
41
35
  name="Fan sleep mode",
42
36
  container=self,
@@ -2,14 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING
6
-
7
5
  from ...feature import Feature
8
6
  from ..smartmodule import SmartModule
9
7
 
10
- if TYPE_CHECKING:
11
- from ..smartdevice import SmartDevice
12
-
13
8
 
14
9
  class HumiditySensor(SmartModule):
15
10
  """Implementation of humidity module."""
@@ -17,11 +12,11 @@ class HumiditySensor(SmartModule):
17
12
  REQUIRED_COMPONENT = "humidity"
18
13
  QUERY_GETTER_NAME = "get_comfort_humidity_config"
19
14
 
20
- def __init__(self, device: SmartDevice, module: str):
21
- super().__init__(device, module)
15
+ def _initialize_features(self):
16
+ """Initialize features after the initial update."""
22
17
  self._add_feature(
23
18
  Feature(
24
- device,
19
+ self._device,
25
20
  id="humidity",
26
21
  name="Humidity",
27
22
  container=self,
@@ -34,7 +29,7 @@ class HumiditySensor(SmartModule):
34
29
  )
35
30
  self._add_feature(
36
31
  Feature(
37
- device,
32
+ self._device,
38
33
  id="humidity_warning",
39
34
  name="Humidity warning",
40
35
  container=self,
@@ -152,7 +152,7 @@ class Light(SmartModule, LightInterface):
152
152
  """Return the current light state."""
153
153
  return self._light_state
154
154
 
155
- def _post_update_hook(self) -> None:
155
+ async def _post_update_hook(self) -> None:
156
156
  if self._device.is_on is False:
157
157
  state = LightState(light_on=False)
158
158
  else:
@@ -28,7 +28,7 @@ class LightEffect(SmartModule, SmartLightEffect):
28
28
  _effect_list: list[str]
29
29
  _scenes_names_to_id: dict[str, str]
30
30
 
31
- def _post_update_hook(self) -> None:
31
+ async def _post_update_hook(self) -> None:
32
32
  """Update internal effect state."""
33
33
  # Copy the effects so scene name updates do not update the underlying dict.
34
34
  effects = copy.deepcopy(
@@ -34,7 +34,7 @@ class LightPreset(SmartModule, LightPresetInterface):
34
34
  self._state_in_sysinfo = self.SYS_INFO_STATE_KEY in device.sys_info
35
35
  self._brightness_only: bool = False
36
36
 
37
- def _post_update_hook(self):
37
+ async def _post_update_hook(self):
38
38
  """Update the internal presets."""
39
39
  index = 0
40
40
  self._presets = {}
@@ -90,7 +90,7 @@ class LightTransition(SmartModule):
90
90
  )
91
91
  )
92
92
 
93
- def _post_update_hook(self) -> None:
93
+ async def _post_update_hook(self) -> None:
94
94
  """Update the states."""
95
95
  # Assumes any device with state in sysinfo supports on and off and
96
96
  # has maximum values for both.
@@ -2,14 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING
6
-
7
5
  from ...feature import Feature
8
6
  from ..smartmodule import SmartModule
9
7
 
10
- if TYPE_CHECKING:
11
- from ..smartdevice import SmartDevice
12
-
13
8
 
14
9
  class ReportMode(SmartModule):
15
10
  """Implementation of report module."""
@@ -17,11 +12,11 @@ class ReportMode(SmartModule):
17
12
  REQUIRED_COMPONENT = "report_mode"
18
13
  QUERY_GETTER_NAME = "get_report_mode"
19
14
 
20
- def __init__(self, device: SmartDevice, module: str):
21
- super().__init__(device, module)
15
+ def _initialize_features(self):
16
+ """Initialize features after the initial update."""
22
17
  self._add_feature(
23
18
  Feature(
24
- device,
19
+ self._device,
25
20
  id="report_interval",
26
21
  name="Report interval",
27
22
  container=self,
@@ -2,14 +2,11 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import TYPE_CHECKING, Literal
5
+ from typing import Literal
6
6
 
7
7
  from ...feature import Feature
8
8
  from ..smartmodule import SmartModule
9
9
 
10
- if TYPE_CHECKING:
11
- from ..smartdevice import SmartDevice
12
-
13
10
 
14
11
  class TemperatureSensor(SmartModule):
15
12
  """Implementation of temperature module."""
@@ -17,11 +14,11 @@ class TemperatureSensor(SmartModule):
17
14
  REQUIRED_COMPONENT = "temperature"
18
15
  QUERY_GETTER_NAME = "get_comfort_temp_config"
19
16
 
20
- def __init__(self, device: SmartDevice, module: str):
21
- super().__init__(device, module)
17
+ def _initialize_features(self):
18
+ """Initialize features after the initial update."""
22
19
  self._add_feature(
23
20
  Feature(
24
- device,
21
+ self._device,
25
22
  id="temperature",
26
23
  name="Temperature",
27
24
  container=self,
@@ -32,10 +29,10 @@ class TemperatureSensor(SmartModule):
32
29
  type=Feature.Type.Sensor,
33
30
  )
34
31
  )
35
- if "current_temp_exception" in device.sys_info:
32
+ if "current_temp_exception" in self._device.sys_info:
36
33
  self._add_feature(
37
34
  Feature(
38
- device,
35
+ self._device,
39
36
  id="temperature_warning",
40
37
  name="Temperature warning",
41
38
  container=self,
@@ -47,7 +44,7 @@ class TemperatureSensor(SmartModule):
47
44
  )
48
45
  self._add_feature(
49
46
  Feature(
50
- device,
47
+ self._device,
51
48
  id="temperature_unit",
52
49
  name="Temperature unit",
53
50
  container=self,
@@ -2,16 +2,16 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from datetime import datetime, timedelta, timezone
5
+ from datetime import datetime, timedelta, timezone, tzinfo
6
6
  from time import mktime
7
- from typing import TYPE_CHECKING, cast
7
+ from typing import cast
8
8
 
9
+ from zoneinfo import ZoneInfoNotFoundError
10
+
11
+ from ...cachedzoneinfo import CachedZoneInfo
9
12
  from ...feature import Feature
10
13
  from ..smartmodule import SmartModule
11
14
 
12
- if TYPE_CHECKING:
13
- from ..smartdevice import SmartDevice
14
-
15
15
 
16
16
  class Time(SmartModule):
17
17
  """Implementation of device_local_time."""
@@ -19,12 +19,13 @@ class Time(SmartModule):
19
19
  REQUIRED_COMPONENT = "time"
20
20
  QUERY_GETTER_NAME = "get_device_time"
21
21
 
22
- def __init__(self, device: SmartDevice, module: str):
23
- super().__init__(device, module)
22
+ _timezone: tzinfo = timezone.utc
24
23
 
24
+ def _initialize_features(self):
25
+ """Initialize features after the initial update."""
25
26
  self._add_feature(
26
27
  Feature(
27
- device=device,
28
+ device=self._device,
28
29
  id="device_time",
29
30
  name="Device time",
30
31
  attribute_getter="time",
@@ -34,19 +35,32 @@ class Time(SmartModule):
34
35
  )
35
36
  )
36
37
 
37
- @property
38
- def time(self) -> datetime:
39
- """Return device's current datetime."""
38
+ async def _post_update_hook(self):
39
+ """Perform actions after a device update."""
40
40
  td = timedelta(minutes=cast(float, self.data.get("time_diff")))
41
- if self.data.get("region"):
42
- tz = timezone(td, str(self.data.get("region")))
41
+ if region := self.data.get("region"):
42
+ try:
43
+ # Zoneinfo will return a DST aware object
44
+ tz: tzinfo = await CachedZoneInfo.get_cached_zone_info(region)
45
+ except ZoneInfoNotFoundError:
46
+ tz = timezone(td, region)
43
47
  else:
44
48
  # in case the device returns a blank region this will result in the
45
49
  # tzname being a UTC offset
46
50
  tz = timezone(td)
51
+ self._timezone = tz
52
+
53
+ @property
54
+ def timezone(self) -> tzinfo:
55
+ """Return current timezone."""
56
+ return self._timezone
57
+
58
+ @property
59
+ def time(self) -> datetime:
60
+ """Return device's current datetime."""
47
61
  return datetime.fromtimestamp(
48
62
  cast(float, self.data.get("timestamp")),
49
- tz=tz,
63
+ tz=self.timezone,
50
64
  )
51
65
 
52
66
  async def set_time(self, dt: datetime):
@@ -3,14 +3,10 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from enum import Enum
6
- from typing import TYPE_CHECKING
7
6
 
8
7
  from ...feature import Feature
9
8
  from ..smartmodule import SmartModule
10
9
 
11
- if TYPE_CHECKING:
12
- from ..smartdevice import SmartDevice
13
-
14
10
 
15
11
  class WaterleakStatus(Enum):
16
12
  """Waterleawk status."""
@@ -25,11 +21,11 @@ class WaterleakSensor(SmartModule):
25
21
 
26
22
  REQUIRED_COMPONENT = "sensor_alarm"
27
23
 
28
- def __init__(self, device: SmartDevice, module: str):
29
- super().__init__(device, module)
24
+ def _initialize_features(self):
25
+ """Initialize features after the initial update."""
30
26
  self._add_feature(
31
27
  Feature(
32
- device,
28
+ self._device,
33
29
  id="water_leak",
34
30
  name="Water leak",
35
31
  container=self,
@@ -41,7 +37,7 @@ class WaterleakSensor(SmartModule):
41
37
  )
42
38
  self._add_feature(
43
39
  Feature(
44
- device,
40
+ self._device,
45
41
  id="water_alert",
46
42
  name="Water alert",
47
43
  container=self,
@@ -61,7 +61,7 @@ class SmartChildDevice(SmartDevice):
61
61
  self._last_update = await self.protocol.query(req)
62
62
 
63
63
  for module in self.modules.values():
64
- self._handle_module_post_update(
64
+ await self._handle_module_post_update(
65
65
  module, now, had_query=module in module_queries
66
66
  )
67
67
  self._last_update_time = now
kasa/smart/smartdevice.py CHANGED
@@ -6,8 +6,8 @@ import base64
6
6
  import logging
7
7
  import time
8
8
  from collections.abc import Mapping, Sequence
9
- from datetime import datetime, timedelta, timezone
10
- from typing import Any, cast
9
+ from datetime import datetime, timedelta, timezone, tzinfo
10
+ from typing import TYPE_CHECKING, Any, cast
11
11
 
12
12
  from ..aestransport import AesTransport
13
13
  from ..device import Device, WifiNetwork
@@ -66,6 +66,7 @@ class SmartDevice(Device):
66
66
  self._children: Mapping[str, SmartDevice] = {}
67
67
  self._last_update = {}
68
68
  self._last_update_time: float | None = None
69
+ self._on_since: datetime | None = None
69
70
 
70
71
  async def _initialize_children(self):
71
72
  """Initialize children for power strips."""
@@ -167,7 +168,7 @@ class SmartDevice(Device):
167
168
  await self._initialize_modules()
168
169
  # Run post update for the cloud module
169
170
  if cloud_mod := self.modules.get(Module.Cloud):
170
- self._handle_module_post_update(cloud_mod, now, had_query=True)
171
+ await self._handle_module_post_update(cloud_mod, now, had_query=True)
171
172
 
172
173
  resp = await self._modular_update(first_update, now)
173
174
 
@@ -194,7 +195,7 @@ class SmartDevice(Device):
194
195
  updated = self._last_update if first_update else resp
195
196
  _LOGGER.debug("Update completed %s: %s", self.host, list(updated.keys()))
196
197
 
197
- def _handle_module_post_update(
198
+ async def _handle_module_post_update(
198
199
  self, module: SmartModule, update_time: float, had_query: bool
199
200
  ):
200
201
  if module.disabled:
@@ -202,7 +203,7 @@ class SmartDevice(Device):
202
203
  if had_query:
203
204
  module._last_update_time = update_time
204
205
  try:
205
- module._post_update_hook()
206
+ await module._post_update_hook()
206
207
  module._set_error(None)
207
208
  except Exception as ex:
208
209
  # Only set the error if a query happened.
@@ -259,7 +260,7 @@ class SmartDevice(Device):
259
260
 
260
261
  # Call handle update for modules that want to update internal data
261
262
  for module in self._modules.values():
262
- self._handle_module_post_update(
263
+ await self._handle_module_post_update(
263
264
  module, update_time, had_query=module in module_queries
264
265
  )
265
266
 
@@ -494,21 +495,32 @@ class SmartDevice(Device):
494
495
 
495
496
  @property
496
497
  def on_since(self) -> datetime | None:
497
- """Return the time that the device was turned on or None if turned off."""
498
+ """Return the time that the device was turned on or None if turned off.
499
+
500
+ This returns a cached value if the device reported value difference is under
501
+ five seconds to avoid device-caused jitter.
502
+ """
498
503
  if (
499
504
  not self._info.get("device_on")
500
505
  or (on_time := self._info.get("on_time")) is None
501
506
  ):
507
+ self._on_since = None
502
508
  return None
503
509
 
504
510
  on_time = cast(float, on_time)
505
- return self.time - timedelta(seconds=on_time)
511
+ on_since = self.time - timedelta(seconds=on_time)
512
+ if not self._on_since or timedelta(
513
+ seconds=0
514
+ ) < on_since - self._on_since > timedelta(seconds=5):
515
+ self._on_since = on_since
516
+ return self._on_since
506
517
 
507
518
  @property
508
- def timezone(self) -> dict:
519
+ def timezone(self) -> tzinfo:
509
520
  """Return the timezone and time_difference."""
510
- ti = self.time
511
- return {"timezone": ti.tzname()}
521
+ if TYPE_CHECKING:
522
+ assert self.time.tzinfo
523
+ return self.time.tzinfo
512
524
 
513
525
  @property
514
526
  def hw_info(self) -> dict:
kasa/smart/smartmodule.py CHANGED
@@ -121,7 +121,7 @@ class SmartModule(Module):
121
121
  """Name of the module."""
122
122
  return getattr(self, "NAME", self.__class__.__name__)
123
123
 
124
- def _post_update_hook(self): # noqa: B027
124
+ async def _post_update_hook(self): # noqa: B027
125
125
  """Perform actions after a device update.
126
126
 
127
127
  Any modules overriding this should ensure that self.data is
@@ -136,12 +136,12 @@ class SmartModule(Module):
136
136
  """
137
137
  return {self.QUERY_GETTER_NAME: None}
138
138
 
139
- def call(self, method, params=None):
139
+ async def call(self, method, params=None):
140
140
  """Call a method.
141
141
 
142
142
  Just a helper method.
143
143
  """
144
- return self._device._query_helper(method, params)
144
+ return await self._device._query_helper(method, params)
145
145
 
146
146
  @property
147
147
  def data(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-kasa
3
- Version: 0.7.4
3
+ Version: 0.7.5
4
4
  Summary: Python API for TP-Link Kasa and Tapo devices
5
5
  Project-URL: Homepage, https://github.com/python-kasa/python-kasa
6
6
  Project-URL: Bug Tracker, https://github.com/python-kasa/python-kasa/issues
@@ -24,6 +24,7 @@ Requires-Dist: asyncclick>=8.1.7
24
24
  Requires-Dist: cryptography>=1.9
25
25
  Requires-Dist: pydantic>=1.10.15
26
26
  Requires-Dist: typing-extensions<5.0,>=4.12.2
27
+ Requires-Dist: tzdata>=2024.2; platform_system == 'Windows'
27
28
  Provides-Extra: docs
28
29
  Requires-Dist: docutils>=0.17; extra == 'docs'
29
30
  Requires-Dist: myst-parser; extra == 'docs'
@@ -1,19 +1,20 @@
1
1
  kasa/__init__.py,sha256=Hxo9ItTa2noIYRXWVSneK15nDUWdd3fBUcYYJTlC2bM,4454
2
2
  kasa/aestransport.py,sha256=Cin2Zz_XUi5N9r8YLmqchkYnLU6ZHHIAg4tIQjPO43A,17128
3
+ kasa/cachedzoneinfo.py,sha256=PLFn9f52E9WdKG3Zhvul3QlrSznmzWPT4fpX5iBuzok,778
3
4
  kasa/credentials.py,sha256=SU9O5QjkWsozC7oCMhc2abydmETNjLZrJwv_KJ6fnK4,357
4
- kasa/device.py,sha256=r2Zr18nVDDaLlV6x5lhfqakG_EFUSMPsWZ068BCjiwg,17862
5
- kasa/device_factory.py,sha256=2o9galcsQOajt8H4zdii1Ads4lgdhQQHAQlwCy-LsIk,7043
5
+ kasa/device.py,sha256=f8AATuQ9Xh7-PtV0VtA49p8qHPS0pq-tq6LrK76N16Q,18019
6
+ kasa/device_factory.py,sha256=DvqRx47TFk309VhZwOEYkqF8qecz0XheKGGwxn5wjeo,7069
6
7
  kasa/device_type.py,sha256=MJW1bVoAcH_MILSW8IBpv3jKRbPWkxmvuWdU-7Ov_D0,744
7
8
  kasa/deviceconfig.py,sha256=pqAxoA41pIG9Q0E3jdlQKsbPd1Qvc8AScULjaZXxInc,8196
8
- kasa/discover.py,sha256=i29XbjJ9IVyxNLXmQdXPEMIajpWb3euFGoplSLGr7NY,23650
9
+ kasa/discover.py,sha256=geQTOaYwjZ-AT4m6lGg-P-Nd5J79ZhYdOUWSGJ9FoWY,23676
9
10
  kasa/emeterstatus.py,sha256=0EF5XwicsKPKTu6NV80Bs904yOGrCij_3SxsmjpVQrk,2530
10
11
  kasa/exceptions.py,sha256=Wek1F49MNEsw9xBS7tpzHi92ZeECM7sI_V13RoQ4UoI,4237
11
12
  kasa/feature.py,sha256=ejhoowq4oPIKC29VRoQYhUZwGqUuJro8Bi7GuLl9WMw,10549
12
13
  kasa/httpclient.py,sha256=5Tiu6moDHkQWqIAr4w9HdwWmuEuxftDmMXzKe1yj_uc,5631
13
14
  kasa/iotprotocol.py,sha256=uj5chjjbPYAVFn3gNSHYIG74qxqzsovsmkRYEHunczY,5566
14
15
  kasa/json.py,sha256=cPLAwsWD1yCp3_dHe4CjgrM29FaICHbqUL37QYoiipk,415
15
- kasa/klaptransport.py,sha256=PPbf2w1F9tLfiYxcTxqM1WyeDaapo2ZkNp1_b0FeyTA,18564
16
- kasa/module.py,sha256=-Zy0zZV6VfpFtTsSa90L8vUHHUowmZrGP9jQ7iLTwcw,6758
16
+ kasa/klaptransport.py,sha256=BR5WplpdrSrz3z1OSXytrQP1ir05KFe-vezi8A2VUOU,18508
17
+ kasa/module.py,sha256=SzDU5afy-YkpMXuYcdapsTUPpnYXi83pUY5GVa0UDVw,6764
17
18
  kasa/modulemapping.py,sha256=79mtaewNYvhFjn1Jo39xE57aid5gn08A-45bOS0vgMs,499
18
19
  kasa/modulemapping.pyi,sha256=dP-zCo8FiFOC68TtpBlxDcJASDwUur1gFyC9Ei9aaMU,3853
19
20
  kasa/protocol.py,sha256=0d3xfO_vGffOllvGu8lU3ZPyqPQ8hCv4RxOnVWjsPhM,4663
@@ -23,7 +24,7 @@ kasa/xortransport.py,sha256=sXZ6AhCsvmahSIszzDEuv2KXUoPAYBTLQ60e43cSg7k,8428
23
24
  kasa/cli/__init__.py,sha256=S8z6xs4EPXXtF2wLwuvDLjcuy46c0jWaG0wiqqU5FiY,27
24
25
  kasa/cli/__main__.py,sha256=B5nsKIZhYL1upQHrrKXnqE3t261v8nthD52e8m3DAgY,88
25
26
  kasa/cli/common.py,sha256=ETCuAaPyxJaGQXgpVDjt-9g7kIJZjtk-YXLdw9yjFB0,7360
26
- kasa/cli/device.py,sha256=PLCi3Cwyy6soneJTli_bakz3kI2It4KAg2MA5LViyFQ,5291
27
+ kasa/cli/device.py,sha256=4N_QAx6B7TR7IHZZyD3BgdZbI4g_i5kIJl1eMQoWHs8,5292
27
28
  kasa/cli/discover.py,sha256=3FF_CsfbTsd8zsNidOCTDLbHLfVnrc0Fae3FSpPiag4,4742
28
29
  kasa/cli/feature.py,sha256=3cm33EuTHDwGX4AX9rZHCIp0J2YHowWeE6O3Rg9EQ0w,3486
29
30
  kasa/cli/lazygroup.py,sha256=KBm-21HwxiOnO8houCTBGkPjQiW3cwoCm4DlvJyGzI0,2486
@@ -43,62 +44,63 @@ kasa/interfaces/lightpreset.py,sha256=oDIilwkSV03EJ-TgwblFhKavFh6JzXQ3uBAw2t8lNJ
43
44
  kasa/iot/__init__.py,sha256=k0QlxHTzb_btqNIIpUd9ybDo-CjkQLa1DReyAkTfs4I,399
44
45
  kasa/iot/effects.py,sha256=au35HDrHso7JRdv9bPSdkepdpR8NbSp-gFGHW2SKZUw,7506
45
46
  kasa/iot/iotbulb.py,sha256=_zQbQShjJQZ9SBD5POzir1dNpNPDKzDpqQg72licV58,18475
46
- kasa/iot/iotdevice.py,sha256=Apsbz5w3f7H2C73UWivIFO3ShBa845U1ofGPktMtuaI,22883
47
+ kasa/iot/iotdevice.py,sha256=T10jHCmItJm1ZeidRrMB-xaiCtLUsHN0wEuvsNV5-wg,23265
47
48
  kasa/iot/iotdimmer.py,sha256=aWHgpw7B8XF_t5s3fOPoAJilV8vpFl2H6kUQIH0Qc4g,7780
48
49
  kasa/iot/iotlightstrip.py,sha256=uJ9EeN1qiyTcOKhc2Hwso3_1TQMKg1cv4yIUFYpgX5U,2104
49
50
  kasa/iot/iotmodule.py,sha256=M3OHij6gq4J49Ybsd1QUhEn8W-VXxoF6FMkn2IcSyDo,2095
50
51
  kasa/iot/iotplug.py,sha256=34PH4V1Dpw6pg8j1mBZxI6nfx-JjwerX-0fprOubkU0,2986
51
- kasa/iot/iotstrip.py,sha256=BIT1gHJy8P4gpjEMkJtE1kMb36UpWZwAR6tW6LdCV0U,15908
52
+ kasa/iot/iotstrip.py,sha256=EFKL_cPfPbaJgitnl79ND6jyE5ZeWGpso6z8ZXgu8DQ,16139
53
+ kasa/iot/iottimezone.py,sha256=6ekrN9tDa5aJKb4HyLLNH5DIJwot2O8QR3kua4t4XLw,4178
52
54
  kasa/iot/modules/__init__.py,sha256=Nq49DvOol1DcURsL3ZmXRLOmQRAgA7s3yFA9aiKQkss,751
53
- kasa/iot/modules/ambientlight.py,sha256=ECdRCsC7L1WV3gY-0MTUlo0vzvvqLRsU5_LOX3FyJ-E,2473
55
+ kasa/iot/modules/ambientlight.py,sha256=Wsy8lsm7S7JbFwAvYBmEKLTWl0cEtpUhXb37Hy-Arqo,2494
54
56
  kasa/iot/modules/antitheft.py,sha256=XV5NM_zMLMU50KpR-MCFGx-1S4TxB61jcuOh3KZ-9Zc,235
55
- kasa/iot/modules/cloud.py,sha256=CWL54K3iC7VQ7NBdnX039fz6r-MjCwxdhOGqv2QCk7c,2037
57
+ kasa/iot/modules/cloud.py,sha256=8dR34gu2Xm5bjJH9wrNFN8ze4qmmtK5ErJ7_AeJcxCE,2058
56
58
  kasa/iot/modules/countdown.py,sha256=53PUMGv3L1zMTkx1PBRvMSGzqX6ZnbwmtXHMyBioT4o,159
57
- kasa/iot/modules/emeter.py,sha256=vv9jiDTD8oxB_vgXPSSB0RMe65Y0xGm-0Dy7mqqv2II,5025
59
+ kasa/iot/modules/emeter.py,sha256=UTv1GHRGnYlAe0I8BpoueFXVHrWGJztwSjjArIOF6nI,5031
58
60
  kasa/iot/modules/led.py,sha256=J0utBGM7kttH6Llv9TN-W264ttAGp2dx3duJRNSVejc,971
59
- kasa/iot/modules/light.py,sha256=n5hdgn6IOTe3uhAb4suIjEQwkxmsQsvrbqqM8j7VQZ8,9619
61
+ kasa/iot/modules/light.py,sha256=RUYJ9mPRJQMpvURf8MZbVNp5dS63IEjk6SDOGctX0co,9625
60
62
  kasa/iot/modules/lighteffect.py,sha256=nz4fUnJ_4j2hrzF5r8ZP0gOwYgSry2g283Y1IXEs2kU,4199
61
- kasa/iot/modules/lightpreset.py,sha256=2FNUrrbHhBzXrJH3AlI66OTrXgKwrjkSc2NN8xyPZmI,5559
63
+ kasa/iot/modules/lightpreset.py,sha256=QuLodJzfK-zfusYDJKv88NLPXTaLzkM1X4H-c4cd87o,5565
62
64
  kasa/iot/modules/motion.py,sha256=lfxM0CFGacjZrBh6UqN5Kyja4beXwrTNxZUU4lh0xZg,2264
63
65
  kasa/iot/modules/rulemodule.py,sha256=_QgsgMRvnh2M2xLx0ACvPdhn_3LZ9zwTbhpT5oQqxvE,2040
64
66
  kasa/iot/modules/schedule.py,sha256=r9MbXp4CRV8qKPlSXWY5RpHqkT6ULdLGLg8P857sEqI,151
65
- kasa/iot/modules/time.py,sha256=4cuogMUfHEcbQ3kCVKuD1Ms2qviU0sXK5yQhaYW_Jpg,1415
67
+ kasa/iot/modules/time.py,sha256=HOxNylESn5pLA3fUo4Lcxwo5DUbqVoWdaWozndrkMS8,1789
66
68
  kasa/iot/modules/usage.py,sha256=YeeUdVJ6Koj2eSQ0U9qETdqhBrUVd0j7cnY1XOhVSlc,3819
67
69
  kasa/smart/__init__.py,sha256=gdmi-Doe7dnv7e8ab_892lr9IdOXeFa3XlU3u_CePCk,198
68
70
  kasa/smart/effects.py,sha256=E3oPHeWlc4lzThBbYV_UC2q-3EpdRiWf8eZiENMfb4k,11476
69
- kasa/smart/smartchilddevice.py,sha256=7n3yRqnhAQS3C2TGn2Nzq8HHcxynFdLZOiT_JlQRLA4,3346
70
- kasa/smart/smartdevice.py,sha256=nfNVLK3dBR94NgxY7FVd1ComELdKdUqXWjkmYdEGCXo,26617
71
- kasa/smart/smartmodule.py,sha256=la_JldxPEpAmleL4qjtEJ6QmiEUeLfyS7A353iJGtAc,7046
71
+ kasa/smart/smartchilddevice.py,sha256=ihSNFAULetGbha-xRjDQvJFyesBVmkt9tM8ERt8rpjk,3352
72
+ kasa/smart/smartdevice.py,sha256=jAPTjrmFYupTYGw_oe0ehUPwdPr6oPUhiMpjyRXviT4,27124
73
+ kasa/smart/smartmodule.py,sha256=HW_VzpuUO6_wcCu_QA6Kf-VZ1TWxD7ry7SKrKvnucpQ,7064
72
74
  kasa/smart/modules/__init__.py,sha256=YcgDqJ1-OxRYW2NlXyfqhYV-kcFkUo6OQ6ppuVrBCj4,1573
73
75
  kasa/smart/modules/alarm.py,sha256=y0ebu-fuVELE-lmVNInr24CvI1TtE9289-BZU8blHBc,4387
74
76
  kasa/smart/modules/autooff.py,sha256=PksBuMJ-MGeqsiI0ZSQ-192DToKwC86Pu8fI_b6o1nA,3253
75
77
  kasa/smart/modules/batterysensor.py,sha256=E0GZM067J_BHd6K8AO4DrUO8ZLZKubiiDZKL2taNNjY,1753
76
78
  kasa/smart/modules/brightness.py,sha256=aP6i-y812eQ4MP-r5LegY1mM1HwYD_37oYJ-ZWQeVZk,2621
77
79
  kasa/smart/modules/childdevice.py,sha256=oxzSEk0uDcxtsTfT0TPPb0otPb9fwKpFObihNVheL64,991
78
- kasa/smart/modules/cloud.py,sha256=sLmckPs1XW4dLPOXAD5bIoJg6lnWDxvoeG7OVNoiBxo,1133
79
- kasa/smart/modules/color.py,sha256=a0tKJ8QsnSRVFmYX76pHHJARGIuuLG9WK2yvoC2TI0g,3154
80
+ kasa/smart/modules/cloud.py,sha256=9GLz0Z69Ebv0Bv5Npjb0N91VCD9TbOy85zL_0BTDotE,1040
81
+ kasa/smart/modules/color.py,sha256=-eJ9ANfh6uiHpwoD1oDMBn9ClBPlxTI8e10d8Xey8lQ,3062
80
82
  kasa/smart/modules/colortemperature.py,sha256=qeX9Pf3jydNp1-6KiDAEa-YPXdbrTt22_Rpoz3wMOkw,2506
81
- kasa/smart/modules/contactsensor.py,sha256=wnKkb5yt7OPvdvfFjYlB0_xKsTptviNSQD19UDJQ3sY,1145
82
- kasa/smart/modules/devicemodule.py,sha256=3SixQV2wXLf14Z3ZA4poHY93pnWK4XHvmHPLkUfOXWw,780
83
+ kasa/smart/modules/contactsensor.py,sha256=kpSgXxu1NgPqD9MkYdUNDBB9Ki6FUbOrwZVvK9W0Jps,1053
84
+ kasa/smart/modules/devicemodule.py,sha256=2K1stwnsu9i55jjhHdozOc25_MitgmypgphgkkMOdcc,786
83
85
  kasa/smart/modules/energy.py,sha256=-GffhX5hgpfuQczZfWyUTDGmCpV2Mi4bthubqdjsXp8,3391
84
- kasa/smart/modules/fan.py,sha256=7Vx3o_bKPQxW9FNWN0otX3-80YTwy_-mvttupD1EeXs,2531
86
+ kasa/smart/modules/fan.py,sha256=dTW99W_-1LxpDLjlw7jRdrojHnvG2LoZ178n8qdzcw0,2444
85
87
  kasa/smart/modules/firmware.py,sha256=SAOtOKg6tlG-Br-TDcP5uRMm_AjTQWeyJ_LlPQKD44I,8534
86
88
  kasa/smart/modules/frostprotection.py,sha256=NsNhbvMnuCoUJWGbAWfP7_ODoOiIGISTHHE-Xj9IeNw,1125
87
- kasa/smart/modules/humiditysensor.py,sha256=tx_LTkk3cEW5DPxrRpSysvCY-XfG7wJ395zTtj6j2hs,1770
89
+ kasa/smart/modules/humiditysensor.py,sha256=vPnKXHg4_T6tmbioRYjhlfV1v2tgPSv0VurEU6vHmLQ,1684
88
90
  kasa/smart/modules/led.py,sha256=iOx8SJkOECyZ_C2j7bJRHsHHP8LCq6Izvyk0jIqUgrg,1503
89
- kasa/smart/modules/light.py,sha256=myZ6OeXYquLGBtkw7r66ThcPTiclTIsO5YZJr9O8KMA,5713
90
- kasa/smart/modules/lighteffect.py,sha256=etR3XLBRP6IbzIO7m7PfHxvdLDL8FIfiWQjfOlv48Ro,6291
91
- kasa/smart/modules/lightpreset.py,sha256=BSFcopPABaHLF1CERQxe6LkhSdnXSfO6MIINXFHLjK4,6497
91
+ kasa/smart/modules/light.py,sha256=IaYt-rUaar6JzAF5aky8YqqBuMf3SgR_XSGTjQzCPHY,5719
92
+ kasa/smart/modules/lighteffect.py,sha256=j1O9KMb6ctHjkA_HQM7tTjed905p5WkN9xSr2RfmVP8,6297
93
+ kasa/smart/modules/lightpreset.py,sha256=W4PUqKcfiLUsfNkYeutWmUNeFJJPTXPJ-Uh23EfHIEE,6503
92
94
  kasa/smart/modules/lightstripeffect.py,sha256=0sPh2xjiS9GEnB5jiA0hm2nF9rzcub4ccwo18MfIt68,6026
93
- kasa/smart/modules/lighttransition.py,sha256=jcuPQnuBylqQwJlA2gZwKW-ToD1cJoGL3X_WNTSz5Cw,8368
95
+ kasa/smart/modules/lighttransition.py,sha256=X9kz4CKxM2iHGV7tDZOvB-D7dZmg6OmrvnDOfJwL0Is,8374
94
96
  kasa/smart/modules/motionsensor.py,sha256=55Qoi8Is3VUJDpyzzD_YBcuup_ZTl_RjsjBn2gLASbg,1012
95
- kasa/smart/modules/reportmode.py,sha256=OZF30Xqlvm6Qo6Fj0IGZdC_dpeTg4r9jYY5IOlUsoeA,1147
97
+ kasa/smart/modules/reportmode.py,sha256=PT7TpWp7nHYjBqHxehHUz8cpkrMZMv5-krntySvTMDg,1055
96
98
  kasa/smart/modules/temperaturecontrol.py,sha256=yE8Y3r2eJAXfPhBzDxvKpr-O7hWUD00L9_rP162VhAg,5801
97
- kasa/smart/modules/temperaturesensor.py,sha256=MFF_27r1ryxQUit2avKo6pZfhuzWSrTVKYqMZgyOVv8,2734
98
- kasa/smart/modules/time.py,sha256=CITnlRTe0z48DL2KHu18UDeGLKCy629eghYPq3MOHo8,1891
99
- kasa/smart/modules/waterleaksensor.py,sha256=yoQtSjM1MO9sMpU2ldtWzHcTPPd7okZNWvjSXmkb4h0,1880
100
- python_kasa-0.7.4.dist-info/METADATA,sha256=layrDibH3At3DPU6_87rd0pWb4CQJYKaakUODg9kV7Y,11682
101
- python_kasa-0.7.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
102
- python_kasa-0.7.4.dist-info/entry_points.txt,sha256=gTVS_oUcmt4q77WSkppQofMelqufh0zeXvvUkmBPRJA,47
103
- python_kasa-0.7.4.dist-info/licenses/LICENSE,sha256=Klt9aEsei738epLgYqeikhpdBWwMvU1VAli14Bxlc5c,33218
104
- python_kasa-0.7.4.dist-info/RECORD,,
99
+ kasa/smart/modules/temperaturesensor.py,sha256=ZgcJalOKRPcuO1-Manzq9DpmC06t9MaU49eEi051elM,2679
100
+ kasa/smart/modules/time.py,sha256=Ed6xW9JQOefl1tCXn-DBnhVlv8Pe9o20VJLI74izGGo,2390
101
+ kasa/smart/modules/waterleaksensor.py,sha256=PPQK1z5JwnqzQGfXmOE4p-5_40Eq-pB4uplzvRiIKYs,1795
102
+ python_kasa-0.7.5.dist-info/METADATA,sha256=IUyIMGblljNUsL3whBShNxHtxSj3tR3AsPOtEfKINUA,11742
103
+ python_kasa-0.7.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
104
+ python_kasa-0.7.5.dist-info/entry_points.txt,sha256=gTVS_oUcmt4q77WSkppQofMelqufh0zeXvvUkmBPRJA,47
105
+ python_kasa-0.7.5.dist-info/licenses/LICENSE,sha256=Klt9aEsei738epLgYqeikhpdBWwMvU1VAli14Bxlc5c,33218
106
+ python_kasa-0.7.5.dist-info/RECORD,,