python-izone 2.0.0__tar.gz → 2.1.0__tar.gz

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 (67) hide show
  1. {python_izone-2.0.0 → python_izone-2.1.0}/PKG-INFO +1 -1
  2. python_izone-2.1.0/docs/release-notes/v2.0.1.md +17 -0
  3. python_izone-2.1.0/docs/release-notes/v2.1.0.md +11 -0
  4. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/__init__.py +2 -0
  5. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/controller.py +91 -12
  6. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/discovery.py +58 -4
  7. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/exceptions.py +35 -0
  8. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/power.py +8 -3
  9. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/version.py +2 -2
  10. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/zone.py +10 -1
  11. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_controller.py +4 -1
  12. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_discovery_api.py +189 -0
  13. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_hardware_hosts.py +30 -0
  14. python_izone-2.1.0/tests/test_reconfiguration.py +259 -0
  15. {python_izone-2.0.0 → python_izone-2.1.0}/.gitattributes +0 -0
  16. {python_izone-2.0.0 → python_izone-2.1.0}/.github/workflows/main.yml +0 -0
  17. {python_izone-2.0.0 → python_izone-2.1.0}/.gitignore +0 -0
  18. {python_izone-2.0.0 → python_izone-2.1.0}/.pre-commit-config.yaml +0 -0
  19. {python_izone-2.0.0 → python_izone-2.1.0}/.python-version +0 -0
  20. {python_izone-2.0.0 → python_izone-2.1.0}/.vscode/.ropeproject/config.py +0 -0
  21. {python_izone-2.0.0 → python_izone-2.1.0}/.vscode/extensions.json +0 -0
  22. {python_izone-2.0.0 → python_izone-2.1.0}/.vscode/launch.json +0 -0
  23. {python_izone-2.0.0 → python_izone-2.1.0}/.vscode/settings.json +0 -0
  24. {python_izone-2.0.0 → python_izone-2.1.0}/README.md +0 -0
  25. {python_izone-2.0.0 → python_izone-2.1.0}/api_docs/AC-DOC-1401-11_iZoneEthernetInterface.pdf +0 -0
  26. {python_izone-2.0.0 → python_izone-2.1.0}/api_docs/iPower_JSON_datastrings_Out.h +0 -0
  27. {python_izone-2.0.0 → python_izone-2.1.0}/api_docs/iZone_JSON_datastrings.h +0 -0
  28. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.10.md +0 -0
  29. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.11.md +0 -0
  30. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.12.md +0 -0
  31. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.4.md +0 -0
  32. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.5.md +0 -0
  33. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.6.md +0 -0
  34. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.7.md +0 -0
  35. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.8.md +0 -0
  36. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v1.3.9.md +0 -0
  37. {python_izone-2.0.0 → python_izone-2.1.0}/docs/release-notes/v2.0.0.md +0 -0
  38. {python_izone-2.0.0 → python_izone-2.1.0}/docs/v2-confirmation.md +0 -0
  39. {python_izone-2.0.0 → python_izone-2.1.0}/licence.txt +0 -0
  40. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/const.py +0 -0
  41. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/py.typed +0 -0
  42. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/types.py +0 -0
  43. {python_izone-2.0.0 → python_izone-2.1.0}/pizone/v2.py +0 -0
  44. {python_izone-2.0.0 → python_izone-2.1.0}/pyproject.toml +0 -0
  45. {python_izone-2.0.0 → python_izone-2.1.0}/scripts/check +0 -0
  46. {python_izone-2.0.0 → python_izone-2.1.0}/scripts/coverage +0 -0
  47. {python_izone-2.0.0 → python_izone-2.1.0}/scripts/izone_v1_probe.py +0 -0
  48. {python_izone-2.0.0 → python_izone-2.1.0}/tests/__init__.py +0 -0
  49. {python_izone-2.0.0 → python_izone-2.1.0}/tests/conftest.py +0 -0
  50. {python_izone-2.0.0 → python_izone-2.1.0}/tests/http_fakes.py +0 -0
  51. {python_izone-2.0.0 → python_izone-2.1.0}/tests/power_data.py +0 -0
  52. {python_izone-2.0.0 → python_izone-2.1.0}/tests/resources.py +0 -0
  53. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_control_zone.py +0 -0
  54. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_discovery.py +0 -0
  55. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_discovery_close_timeout.py +0 -0
  56. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_dump_state.py +0 -0
  57. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_hardware_controller.py +0 -0
  58. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_http.py +0 -0
  59. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_power.py +0 -0
  60. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_v2.py +0 -0
  61. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_v2_confirmation.py +0 -0
  62. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_v2_fan_capability.py +0 -0
  63. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_v2_vendor_enums.py +0 -0
  64. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_v2_zone_validation.py +0 -0
  65. {python_izone-2.0.0 → python_izone-2.1.0}/tests/test_zone.py +0 -0
  66. {python_izone-2.0.0 → python_izone-2.1.0}/tests/v2_fixtures.py +0 -0
  67. {python_izone-2.0.0 → python_izone-2.1.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-izone
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: A python interface to the iZone airconditioner controller
5
5
  Project-URL: Homepage, https://github.com/Swamp-Ig/pizone
6
6
  Author-email: Penny Wood <pypl@ninjateaparty.com>
@@ -0,0 +1,17 @@
1
+ # Release notes — v2.0.1
2
+
3
+ **Compare range:** https://github.com/Swamp-Ig/pizone/compare/v2.0.0...v2.0.1
4
+
5
+ ## Since v2.0.0
6
+
7
+ ### Name re-resolved after a connection loss
8
+
9
+ - A controller created from a name with `create_controller(uid, "bridge.lan")` now remembers the name. When an HTTP refresh fails, the name is resolved again in the background, alongside the existing UDP scan.
10
+ - If the controller's UID answers at a new address, the controller is repointed and `on_address_changed` fires, the same as for a move found over UDP. This finds a bridge that changed address where UDP discovery can't reach it, such as on another VLAN.
11
+ - The check is cooled down per controller. It's skipped when the name still resolves to the current address, or when a UDP verify of that address is already in progress. Failures are logged at debug level only.
12
+ - Controllers created from an IP address are unchanged. No API changes.
13
+
14
+ ### Typing
15
+
16
+ - `DiscoveryService.discover_by_host()` is now annotated as always returning a `ControllerEndpoint`. It has raised `EndpointVerifyError` instead of returning `None` since v2.0.0. Callers can drop their `None` handling.
17
+ - `PowerGroup.group_number` returns the number the group was built from, instead of falling back to `-1`, which would also have reported a group 0 as `-1`. `PowerGroup` now takes the group number as a constructor argument; it's built only by `Power`.
@@ -0,0 +1,11 @@
1
+ # Release notes — v2.1.0
2
+
3
+ **Compare range:** https://github.com/Swamp-Ig/pizone/compare/v2.0.1...v2.1.0
4
+
5
+ ## Since v2.0.1
6
+
7
+ ### Reprogrammed systems are detected
8
+
9
+ - If an installer reprograms the system (zone count, zone types or fan setup), refreshes and commands now raise the new `DeviceReconfigurationError` instead of carrying on with the old layout. Its `changes` attribute lists what changed.
10
+ - To recover, close the controller and create a new one with `DiscoveryService.create_controller()`.
11
+ - `DeviceReconfigurationError` is not a `ConnectionError`, so existing outage handling won't catch it. Callers should catch it and recreate the controller.
@@ -35,6 +35,7 @@ from .discovery import DiscoveryService, create_discovery
35
35
  from .exceptions import (
36
36
  ControllerAlreadyClaimedError,
37
37
  ControllerCommandError,
38
+ DeviceReconfigurationError,
38
39
  EndpointVerifyError,
39
40
  InvalidValueError,
40
41
  ResponseDecodeError,
@@ -77,6 +78,7 @@ __all__ = [
77
78
  "ControllerAlreadyClaimedError",
78
79
  "ControllerCommandError",
79
80
  "ControllerEndpoint",
81
+ "DeviceReconfigurationError",
80
82
  "DiscoveredEndpoints",
81
83
  "DiscoveryService",
82
84
  "EndpointVerifyError",
@@ -15,7 +15,12 @@ from typing import TYPE_CHECKING, Any, Literal, Self, cast
15
15
  import aiohttp
16
16
 
17
17
  from . import power as power_mod, v2 as v2_mod
18
- from .exceptions import ControllerCommandError, InvalidValueError, ResponseDecodeError
18
+ from .exceptions import (
19
+ ControllerCommandError,
20
+ DeviceReconfigurationError,
21
+ InvalidValueError,
22
+ ResponseDecodeError,
23
+ )
19
24
  from .power import Power
20
25
  from .types import ControllerEndpoint, ControllerProbe
21
26
  from .zone import Zone
@@ -43,8 +48,17 @@ def _refresh_api(
43
48
 
44
49
  @wraps(method)
45
50
  async def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any:
46
- async with self._refresh_scope():
47
- return await method(self, *args, **kwargs)
51
+ self._raise_if_reconfigured()
52
+ try:
53
+ async with self._refresh_scope():
54
+ result = await method(self, *args, **kwargs)
55
+ except Exception as ex:
56
+ # A read in this refresh saw the reconfigure; that outranks its errors.
57
+ if self._reconfigured is not None:
58
+ raise DeviceReconfigurationError(dict(self._reconfigured)) from ex
59
+ raise
60
+ self._raise_if_reconfigured()
61
+ return result
48
62
 
49
63
  return wrapper
50
64
 
@@ -175,6 +189,9 @@ class Controller:
175
189
  self._izone_ok: bool = True
176
190
  self._fault_fields: tuple[str, ...] = ()
177
191
  self._last_fault: dict[str, Any] | None = None
192
+ # System fields the zones and fan modes were built from at connect.
193
+ self._built_from: dict[str, Any] | None = None
194
+ self._reconfigured: dict[str, tuple[Any, Any]] | None = None
178
195
  self._on_address_changed: Callable[[ControllerEndpoint], None] | None = None
179
196
 
180
197
  self._sending_lock = Lock()
@@ -211,10 +228,11 @@ class Controller:
211
228
  self._set_bridge_ok(True)
212
229
 
213
230
  def _nudge_scan(self) -> None:
214
- """Non-blocking cooled-down IASD scan after HTTP transport failure."""
231
+ """Non-blocking cooled-down rediscovery after HTTP transport failure."""
215
232
  if self._closed:
216
233
  return
217
234
  self._discovery_service.schedule_cooled_scan()
235
+ self._discovery_service.schedule_name_check(self._device_uid)
218
236
 
219
237
  @classmethod
220
238
  async def create(
@@ -259,19 +277,23 @@ class Controller:
259
277
  if settings is None:
260
278
  raise ConnectionError("SystemSettings device ID mismatch")
261
279
 
262
- if self._system_settings:
263
- fan_auto = str(self._system_settings.get("FanAuto", "disabled"))
264
- self.fan_modes = Controller._VALID_FAN_MODES.get(
265
- fan_auto, Controller._VALID_FAN_MODES["unknown"]
266
- )
267
- else:
268
- self.fan_modes = Controller._VALID_FAN_MODES["disabled"]
280
+ self.fan_modes = Controller._VALID_FAN_MODES.get(
281
+ self._fan_auto(self._system_settings),
282
+ Controller._VALID_FAN_MODES["unknown"],
283
+ )
269
284
 
270
285
  zone_count = int(settings["NoOfZones"])
271
286
  self.zones = [Zone(self, i) for i in range(zone_count)]
272
287
 
273
288
  await self._fetch_zones()
274
289
 
290
+ self._built_from = {
291
+ "NoOfZones": zone_count,
292
+ "NoOfConst": settings.get("NoOfConst"),
293
+ "SysType": settings.get("SysType"),
294
+ "FanAuto": self._fan_auto(self._system_settings),
295
+ }
296
+
275
297
  await self._probe_power()
276
298
 
277
299
  async def _probe_power(self) -> None:
@@ -346,6 +368,7 @@ class Controller:
346
368
  "fan_modes": [fan.value for fan in self.fan_modes],
347
369
  "system_settings": dict(self._system_settings),
348
370
  "last_fault": self._last_fault,
371
+ "reconfigured": self._reconfigured,
349
372
  "zones": [zone.dump_state() for zone in self.zones],
350
373
  "power": self._power.dump_state() if self._power is not None else None,
351
374
  }
@@ -848,6 +871,7 @@ class Controller:
848
871
  """System + zones [+ power] fetch (no refresh scope)."""
849
872
  if self._read_api == "v2":
850
873
  await self._fetch_system()
874
+ self._raise_if_reconfigured()
851
875
  await self._fetch_zones()
852
876
  await self._fetch_power()
853
877
  return
@@ -894,8 +918,56 @@ class Controller:
894
918
 
895
919
  self._system_settings = values
896
920
  self._set_izone_ok(True)
921
+ if not faults and self._built_from is not None:
922
+ self._check_reconfigured(values)
897
923
  return values
898
924
 
925
+ @staticmethod
926
+ def _fan_auto(values: ControllerData) -> str:
927
+ """Return FanAuto as the fan modes read it; absent means disabled."""
928
+ if not values:
929
+ return "disabled"
930
+ return str(values.get("FanAuto", "disabled"))
931
+
932
+ def _check_reconfigured(self, values: ControllerData) -> None:
933
+ """Latch if a clean read no longer matches what was built at connect."""
934
+ built = cast(dict[str, Any], self._built_from)
935
+ if (
936
+ int(values["NoOfZones"]) == built["NoOfZones"]
937
+ and values.get("NoOfConst") == built["NoOfConst"]
938
+ and values.get("SysType") == built["SysType"]
939
+ and self._fan_auto(values) == built["FanAuto"]
940
+ ):
941
+ return
942
+ current = {
943
+ "NoOfZones": int(values["NoOfZones"]),
944
+ "NoOfConst": values.get("NoOfConst"),
945
+ "SysType": values.get("SysType"),
946
+ "FanAuto": self._fan_auto(values),
947
+ }
948
+ self._note_reconfigured(
949
+ {
950
+ field: (old, current[field])
951
+ for field, old in built.items()
952
+ if current[field] != old
953
+ }
954
+ )
955
+
956
+ def _note_reconfigured(self, changes: dict[str, tuple[Any, Any]]) -> None:
957
+ """Latch the reconfigured state; it only clears with a new controller."""
958
+ if self._reconfigured is None:
959
+ self._reconfigured = {}
960
+ _LOG.warning(
961
+ "iZone system reconfigured uid=%s: %s",
962
+ self._device_uid,
963
+ DeviceReconfigurationError(changes),
964
+ )
965
+ self._reconfigured.update(changes)
966
+
967
+ def _raise_if_reconfigured(self) -> None:
968
+ if self._reconfigured is not None:
969
+ raise DeviceReconfigurationError(dict(self._reconfigured))
970
+
899
971
  def _record_faults(
900
972
  self, values: ControllerData, faults: list[str], *, offline: bool
901
973
  ) -> None:
@@ -976,8 +1048,10 @@ class Controller:
976
1048
 
977
1049
  Raises:
978
1050
  ConnectionError: If the HTTP request fails.
1051
+ DeviceReconfigurationError: If the system was reconfigured.
979
1052
 
980
1053
  """
1054
+ self._raise_if_reconfigured()
981
1055
  if send is None:
982
1056
  send = value
983
1057
 
@@ -1007,6 +1081,7 @@ class Controller:
1007
1081
  self, command: str, data: dict[str, Any], zone_index: int
1008
1082
  ) -> None:
1009
1083
  """POST a zone command and confirm with a zone refresh."""
1084
+ self._raise_if_reconfigured()
1010
1085
  async with self._sending_lock, self._refresh_scope():
1011
1086
  if self._read_api == "v2":
1012
1087
  if self._closed:
@@ -1081,7 +1156,11 @@ class Controller:
1081
1156
  """Bounded, read-only confirmation; never resend a zone command."""
1082
1157
  loop = asyncio.get_running_loop()
1083
1158
  try:
1084
- while self._zone_mode_confirmations and not self._closed:
1159
+ while (
1160
+ self._zone_mode_confirmations
1161
+ and not self._closed
1162
+ and self._reconfigured is None
1163
+ ):
1085
1164
  self._expire_zone_modes(loop.time())
1086
1165
  if not self._zone_mode_confirmations:
1087
1166
  break
@@ -119,6 +119,15 @@ _FAILURE_RANK = {
119
119
  type _VerifyResult = ControllerEndpoint | UnverifiedEndpoint | None
120
120
 
121
121
 
122
+ def _is_ipv4(host: str) -> bool:
123
+ """Return whether *host* is an IPv4 address rather than a name."""
124
+ try:
125
+ IPv4Address(host)
126
+ except ValueError:
127
+ return False
128
+ return True
129
+
130
+
122
131
  @dataclass(slots=True)
123
132
  class _Entry:
124
133
  state: _State
@@ -128,6 +137,10 @@ class _Entry:
128
137
  # for KNOWN/CLAIMED a move that applies only once it answers.
129
138
  candidate: ControllerEndpoint | None = None
130
139
  verify: Task[_VerifyResult] | None = None
140
+ # CLAIMED only: the name the controller was created from, re-resolved
141
+ # after a transport failure since UDP discovery may not reach the bridge.
142
+ host_name: str | None = None
143
+ last_name_check: float = float("-inf")
131
144
 
132
145
 
133
146
  class DiscoveryService:
@@ -295,6 +308,43 @@ class DiscoveryService:
295
308
 
296
309
  asyncio.get_running_loop().create_task(_run())
297
310
 
311
+ def schedule_name_check(self, uid: str) -> None:
312
+ """Re-resolve a claimed controller's name in the background, if it has one.
313
+
314
+ Repoints the controller when its UID answers at a new address. Cooled
315
+ down per UID.
316
+ """
317
+ if self.is_closed:
318
+ return
319
+ entry = self._entry(uid, _State.CLAIMED)
320
+ if entry is None or (name := entry.host_name) is None:
321
+ return
322
+ now = asyncio.get_running_loop().time()
323
+ if now - entry.last_name_check < RESCAN_COOLDOWN:
324
+ return
325
+ entry.last_name_check = now
326
+
327
+ async def _run() -> None:
328
+ try:
329
+ addresses = await self._resolve(name)
330
+ if entry.endpoint.host in addresses:
331
+ return
332
+ if entry.candidate is not None and entry.candidate.host in addresses:
333
+ return # A UDP verify of that address is already in flight.
334
+ probed = await self._probe_first(addresses, expected_uid=uid)
335
+ if isinstance(probed, _ProbeFailed):
336
+ _LOG.debug(
337
+ "Name %s for %s did not verify: %s", name, uid, probed.failure
338
+ )
339
+ return
340
+ if self.is_closed or self._endpoints.get(uid) is not entry:
341
+ return
342
+ self._apply_verified(probed.endpoint)
343
+ except Exception: # noqa: BLE001
344
+ _LOG.debug("Name check for %s failed", uid, exc_info=True)
345
+
346
+ self.create_task(_run())
347
+
298
348
  def _entry(self, uid: str, *states: _State) -> _Entry | None:
299
349
  """Return the entry for *uid* when it is in one of *states*."""
300
350
  entry = self._endpoints.get(uid)
@@ -429,7 +479,7 @@ class DiscoveryService:
429
479
  if self._discover_all_notified is not None:
430
480
  self._discover_all_notified.add(endpoint.uid)
431
481
 
432
- async def discover_by_host(self, host: str) -> ControllerEndpoint | None:
482
+ async def discover_by_host(self, host: str) -> ControllerEndpoint:
433
483
  """Return the controller endpoint at *host*, an IPv4 address or a name.
434
484
 
435
485
  A name is resolved to IPv4 addresses first; the returned endpoint always
@@ -604,9 +654,10 @@ class DiscoveryService:
604
654
 
605
655
  Preferred entry point after :func:`create_discovery`. One-shot per
606
656
  UID. *host* may be an IPv4 address or a name; a name is resolved and
607
- the controller runs on the IP that answers. HTTP probe is the trust
608
- boundary; callers must handle the device being unreachable even after a
609
- recent discovery notify.
657
+ the controller runs on the IP that answers. The name is resolved again
658
+ after a transport failure, in case the bridge moved. HTTP probe is the
659
+ trust boundary; callers must handle the device being unreachable even
660
+ after a recent discovery notify.
610
661
 
611
662
  Raises:
612
663
  UnpairedBridgeError: If *uid* is the unpaired placeholder (no I/O).
@@ -657,6 +708,9 @@ class DiscoveryService:
657
708
  del self._endpoints[uid]
658
709
  raise
659
710
 
711
+ if not _is_ipv4(host) and (claimed := self._entry(uid, _State.CLAIMED)):
712
+ claimed.host_name = host
713
+
660
714
  if pending_address_changed is not None and on_address_changed is not None:
661
715
  self.schedule_address_changed(on_address_changed, pending_address_changed)
662
716
  return controller
@@ -1,5 +1,7 @@
1
1
  """pizone-specific exceptions."""
2
2
 
3
+ from typing import Any
4
+
3
5
  from .const import PLACEHOLDER_DEVICE_UID
4
6
  from .types import VerifyFailure, _failure_text
5
7
 
@@ -13,6 +15,39 @@ class ControllerCommandError(Exception):
13
15
  """
14
16
 
15
17
 
18
+ class DeviceReconfigurationError(Exception):
19
+ """The system no longer matches the controller built at connect.
20
+
21
+ Raised once a clean read shows that an installer has reprogrammed the
22
+ system, for example the number of zones or a zone type changed. The
23
+ controller stays this way: every refresh and command raises this until it
24
+ is closed and a new one is created with
25
+ :meth:`~pizone.discovery.DiscoveryService.create_controller`.
26
+
27
+ Not a :exc:`ConnectionError`: the device is reachable and answering.
28
+
29
+ Attributes:
30
+ changes: Each changed field, mapped to its value at connect and its
31
+ new value. Zone types use keys like ``"Zone 3 Type"``.
32
+
33
+ """
34
+
35
+ def __init__(self, changes: dict[str, tuple[Any, Any]]) -> None:
36
+ """Create the error for *changes*."""
37
+ super().__init__()
38
+ self.changes = changes
39
+
40
+ def __str__(self) -> str:
41
+ """Plain-English description, for logs and tracebacks."""
42
+ detail = ", ".join(
43
+ f"{field} {old!r} -> {new!r}" for field, (old, new) in self.changes.items()
44
+ )
45
+ return (
46
+ f"iZone system was reconfigured ({detail}); close this controller "
47
+ "and create a new one"
48
+ )
49
+
50
+
16
51
  class InvalidValueError(ValueError, AttributeError):
17
52
  """A setter rejected a value before sending anything to the device.
18
53
 
@@ -148,8 +148,11 @@ class PowerDevice:
148
148
  class PowerGroup:
149
149
  """Grouped power channels."""
150
150
 
151
- def __init__(self, power: Power, channels: Iterable[PowerChannel]) -> None:
151
+ def __init__(
152
+ self, power: Power, group_number: int, channels: Iterable[PowerChannel]
153
+ ) -> None:
152
154
  self._power = power
155
+ self._group_number = group_number
153
156
  self._channels = tuple(channels)
154
157
  devices: set[PowerDevice] = set()
155
158
  for chan in channels:
@@ -159,7 +162,7 @@ class PowerGroup:
159
162
  @property
160
163
  def group_number(self) -> int:
161
164
  """The group id."""
162
- return self._channels[0].group_number or -1
165
+ return self._group_number
163
166
 
164
167
  @property
165
168
  def name(self) -> str:
@@ -218,7 +221,9 @@ class Power:
218
221
  for chan in dev.channels:
219
222
  if chan.group_number is not None:
220
223
  gdict.setdefault(chan.group_number, []).append(chan)
221
- self._groups = tuple(PowerGroup(self, gl) for gl in gdict.values())
224
+ self._groups = tuple(
225
+ PowerGroup(self, number, chans) for number, chans in gdict.items()
226
+ )
222
227
 
223
228
  async def refresh(self) -> bool:
224
229
  """Refresh power usage data from the device.
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '2.0.0'
22
- __version_tuple__ = version_tuple = (2, 0, 0)
21
+ __version__ = version = '2.1.0'
22
+ __version_tuple__ = version_tuple = (2, 1, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -90,6 +90,8 @@ class Zone:
90
90
  self._zone_data: Zone.ZoneData = {}
91
91
  self._index = index
92
92
  self._controller = controller
93
+ # Zone type at connect; None until the first clean read sets it.
94
+ self._built_type: Zone.DictValue | None = None
93
95
 
94
96
  @property
95
97
  def index(self) -> int:
@@ -278,9 +280,16 @@ class Zone:
278
280
  """
279
281
  if zone_data["Index"] != self._index:
280
282
  raise AttributeError("Can't change index of existing zone.")
281
- if str(zone_data.get("Type")) == "error":
283
+ zone_type = zone_data.get("Type")
284
+ if str(zone_type) == "error":
282
285
  return
283
286
  self._zone_data = zone_data
287
+ if self._built_type is None:
288
+ self._built_type = zone_type
289
+ elif zone_type != self._built_type:
290
+ self._controller._note_reconfigured( # noqa: SLF001
291
+ {f"Zone {self._index + 1} Type": (self._built_type, zone_type)}
292
+ )
284
293
 
285
294
  def _get_zone_state(self, state: str) -> DictValue:
286
295
  return self._zone_data[state]
@@ -5,7 +5,7 @@ from collections.abc import Awaitable, Callable
5
5
  from copy import deepcopy
6
6
  import logging
7
7
  from typing import cast
8
- from unittest.mock import AsyncMock
8
+ from unittest.mock import AsyncMock, Mock
9
9
 
10
10
  import pytest
11
11
 
@@ -733,12 +733,15 @@ async def test_refresh_transport_failure_nudges_scan() -> None:
733
733
  controller._connected = False
734
734
  scan = AsyncMock()
735
735
  service.scan = scan # type: ignore[method-assign]
736
+ name_check = Mock()
737
+ service.schedule_name_check = name_check # type: ignore[method-assign]
736
738
 
737
739
  with pytest.raises(ConnectionError):
738
740
  await controller.refresh_all()
739
741
 
740
742
  await asyncio.sleep(0)
741
743
  scan.assert_awaited_once()
744
+ name_check.assert_called_once_with("000000001")
742
745
  assert controller.bridge_connected is False
743
746
  await service.close()
744
747
 
@@ -1778,6 +1778,195 @@ async def test_create_controller_resolves_name_to_ip() -> None:
1778
1778
  await service.close()
1779
1779
 
1780
1780
 
1781
+ async def _probe_expected(
1782
+ host: str, *, expected_uid: str | None = None
1783
+ ) -> ControllerProbe | _ProbeFailed:
1784
+ """Answer as *expected_uid* at any host."""
1785
+ assert expected_uid is not None
1786
+ return _probe_result(expected_uid, host)
1787
+
1788
+
1789
+ async def _create_at(
1790
+ service: DiscoveryService,
1791
+ uid: str,
1792
+ host: str,
1793
+ *,
1794
+ resolves_to: str,
1795
+ on_address_changed: list[ControllerEndpoint] | None = None,
1796
+ ) -> Controller:
1797
+ """Create a controller from *host*, which resolves to *resolves_to*."""
1798
+ with (
1799
+ patch.object(service, "_resolve", AsyncMock(return_value=[resolves_to])),
1800
+ patch.object(service, "_probe", side_effect=_probe_expected),
1801
+ patch.object(MockController, "_initialize", AsyncMock()),
1802
+ ):
1803
+ return await service.create_controller(
1804
+ uid,
1805
+ host,
1806
+ on_address_changed=(
1807
+ on_address_changed.append if on_address_changed is not None else None
1808
+ ),
1809
+ )
1810
+
1811
+
1812
+ async def _settle_tasks(service: DiscoveryService) -> None:
1813
+ await asyncio.gather(*(task for task in service._tasks if not task.done()))
1814
+ await asyncio.sleep(0)
1815
+
1816
+
1817
+ @pytest.mark.asyncio
1818
+ async def test_name_check_repoints_moved_controller() -> None:
1819
+ """A name that now resolves to another IP repoints the controller there."""
1820
+ service = MockDiscoveryService()
1821
+ seen: list[ControllerEndpoint] = []
1822
+ controller = await _create_at(
1823
+ service,
1824
+ "000025841",
1825
+ "izone.lan",
1826
+ resolves_to="10.0.0.90",
1827
+ on_address_changed=seen,
1828
+ )
1829
+ moved = ControllerEndpoint(uid="000025841", host="10.0.0.91")
1830
+
1831
+ with (
1832
+ patch.object(service, "_resolve", AsyncMock(return_value=[moved.host])),
1833
+ patch.object(service, "_probe", side_effect=_probe_expected),
1834
+ ):
1835
+ service.schedule_name_check(moved.uid)
1836
+ await _settle_tasks(service)
1837
+
1838
+ assert controller.device_ip == moved.host
1839
+ assert service._endpoints_in(_State.CLAIMED) == {moved.uid: moved}
1840
+ assert seen == [moved]
1841
+ await service.close()
1842
+
1843
+
1844
+ @pytest.mark.asyncio
1845
+ async def test_name_check_current_ip_skips_probe() -> None:
1846
+ """When the name still resolves to the current IP, the bridge is just down."""
1847
+ service = MockDiscoveryService()
1848
+ controller = await _create_at(
1849
+ service, "000025841", "izone.lan", resolves_to="10.0.0.90"
1850
+ )
1851
+ probe = AsyncMock()
1852
+
1853
+ with (
1854
+ patch.object(service, "_resolve", AsyncMock(return_value=["10.0.0.90"])),
1855
+ patch.object(service, "_probe", probe),
1856
+ ):
1857
+ service.schedule_name_check("000025841")
1858
+ await _settle_tasks(service)
1859
+
1860
+ probe.assert_not_awaited()
1861
+ assert controller.device_ip == "10.0.0.90"
1862
+ await service.close()
1863
+
1864
+
1865
+ @pytest.mark.asyncio
1866
+ async def test_name_check_defers_to_udp_verify_in_flight() -> None:
1867
+ """A UDP verify already checking the resolved address isn't probed again."""
1868
+ service = MockDiscoveryService()
1869
+ await _create_at(service, "000025841", "izone.lan", resolves_to="10.0.0.90")
1870
+ service._endpoints["000025841"].candidate = ControllerEndpoint(
1871
+ uid="000025841", host="10.0.0.91"
1872
+ )
1873
+ probe = AsyncMock()
1874
+
1875
+ with (
1876
+ patch.object(service, "_resolve", AsyncMock(return_value=["10.0.0.91"])),
1877
+ patch.object(service, "_probe", probe),
1878
+ ):
1879
+ service.schedule_name_check("000025841")
1880
+ await _settle_tasks(service)
1881
+
1882
+ probe.assert_not_awaited()
1883
+ await service.close()
1884
+
1885
+
1886
+ @pytest.mark.asyncio
1887
+ async def test_name_check_other_uid_does_not_repoint() -> None:
1888
+ """A different controller answering at the new address is ignored."""
1889
+ service = MockDiscoveryService()
1890
+ seen: list[ControllerEndpoint] = []
1891
+ controller = await _create_at(
1892
+ service,
1893
+ "000025841",
1894
+ "izone.lan",
1895
+ resolves_to="10.0.0.90",
1896
+ on_address_changed=seen,
1897
+ )
1898
+
1899
+ with (
1900
+ patch.object(service, "_resolve", AsyncMock(return_value=["10.0.0.91"])),
1901
+ patch.object(
1902
+ service,
1903
+ "_probe",
1904
+ AsyncMock(return_value=_ProbeFailed(VerifyFailure.OTHER_UID, "000099999")),
1905
+ ),
1906
+ ):
1907
+ service.schedule_name_check("000025841")
1908
+ await _settle_tasks(service)
1909
+
1910
+ assert controller.device_ip == "10.0.0.90"
1911
+ assert seen == []
1912
+ await service.close()
1913
+
1914
+
1915
+ @pytest.mark.asyncio
1916
+ async def test_name_check_skips_ip_literal() -> None:
1917
+ """A controller created from an IPv4 address has no name to re-resolve."""
1918
+ service = MockDiscoveryService()
1919
+ await _create_at(service, "000025841", "10.0.0.90", resolves_to="10.0.0.90")
1920
+ resolve = AsyncMock()
1921
+
1922
+ with patch.object(service, "_resolve", resolve):
1923
+ service.schedule_name_check("000025841")
1924
+ await _settle_tasks(service)
1925
+
1926
+ resolve.assert_not_awaited()
1927
+ await service.close()
1928
+
1929
+
1930
+ @pytest.mark.asyncio
1931
+ async def test_name_check_cooldown_is_per_controller() -> None:
1932
+ """A second check inside the cooldown is skipped, without blocking others."""
1933
+ service = MockDiscoveryService()
1934
+ await _create_at(service, "000025841", "first.lan", resolves_to="10.0.0.90")
1935
+ await _create_at(service, "000025842", "second.lan", resolves_to="10.0.0.92")
1936
+ resolve = AsyncMock(return_value=[])
1937
+
1938
+ with patch.object(service, "_resolve", resolve):
1939
+ service.schedule_name_check("000025841")
1940
+ service.schedule_name_check("000025841")
1941
+ service.schedule_name_check("000025842")
1942
+ await _settle_tasks(service)
1943
+
1944
+ assert [call.args for call in resolve.await_args_list] == [
1945
+ ("first.lan",),
1946
+ ("second.lan",),
1947
+ ]
1948
+ await service.close()
1949
+
1950
+
1951
+ @pytest.mark.asyncio
1952
+ async def test_name_check_skips_closed_controller() -> None:
1953
+ """Closing a controller drops its name with the claim."""
1954
+ service = MockDiscoveryService()
1955
+ controller = await _create_at(
1956
+ service, "000025841", "izone.lan", resolves_to="10.0.0.90"
1957
+ )
1958
+ await controller.close()
1959
+ resolve = AsyncMock()
1960
+
1961
+ with patch.object(service, "_resolve", resolve):
1962
+ service.schedule_name_check("000025841")
1963
+ await _settle_tasks(service)
1964
+
1965
+ resolve.assert_not_awaited()
1966
+ assert service._endpoints["000025841"].host_name is None
1967
+ await service.close()
1968
+
1969
+
1781
1970
  @pytest.mark.asyncio
1782
1971
  async def test_create_controller_unresolvable_name_falls_back_to_scan() -> None:
1783
1972
  service = MockDiscoveryService()
@@ -159,3 +159,33 @@ async def test_passive_reply_from_same_ip_is_not_a_move(
159
159
  assert live_service._endpoints[bridge.uid].verify is None
160
160
  assert controller.device_ip == bridge.host
161
161
  assert seen == []
162
+
163
+
164
+ @pytest.mark.hardware
165
+ async def test_name_re_resolve_repoints_moved_controller(
166
+ live_service: DiscoveryService, bridge: ControllerEndpoint
167
+ ) -> None:
168
+ """A refresh failure re-resolves the name and finds the bridge again."""
169
+ seen: list[ControllerEndpoint] = []
170
+ with _name_resolves_to(bridge.host):
171
+ controller = await live_service.create_controller(
172
+ bridge.uid, BRIDGE_NAME, on_address_changed=seen.append
173
+ )
174
+ # Simulate the bridge having moved while UDP was blocked.
175
+ controller._ip = WRONG_HOST
176
+ live_service._endpoints[bridge.uid].endpoint = ControllerEndpoint(
177
+ uid=bridge.uid, host=WRONG_HOST
178
+ )
179
+
180
+ # Only the name check may find it, not a UDP scan.
181
+ with patch.object(live_service, "schedule_cooled_scan"):
182
+ with pytest.raises(ConnectionError):
183
+ await controller.refresh_all()
184
+ async with asyncio.timeout(Controller.REQUEST_TIMEOUT * 2):
185
+ while controller.device_ip != bridge.host:
186
+ await asyncio.sleep(0.05)
187
+ await asyncio.sleep(0)
188
+
189
+ assert seen == [bridge]
190
+ await controller.refresh_all()
191
+ assert controller.connected
@@ -0,0 +1,259 @@
1
+ """Latching on a device reconfiguration seen in a clean read."""
2
+
3
+ import asyncio
4
+ from collections.abc import AsyncIterator
5
+ from copy import deepcopy
6
+ from typing import Any, cast
7
+ from unittest.mock import AsyncMock
8
+
9
+ import pytest
10
+
11
+ from pizone import DeviceReconfigurationError, v2
12
+
13
+ from .conftest import MockController, MockDiscoveryService, add_mock_controller
14
+ from .v2_fixtures import SAMPLE_SYSTEM_V2, SAMPLE_ZONES_V2
15
+
16
+
17
+ @pytest.fixture
18
+ async def v2_controller() -> AsyncIterator[MockController]:
19
+ svc = MockDiscoveryService()
20
+ ctrl = MockController(
21
+ svc,
22
+ device_uid="000025841",
23
+ device_ip="192.0.2.1",
24
+ is_v2=True,
25
+ is_ipower=False,
26
+ )
27
+ ctrl._read_api = "v2"
28
+ ctrl.v2_system = deepcopy(SAMPLE_SYSTEM_V2)
29
+ ctrl.v2_zones = deepcopy(SAMPLE_ZONES_V2)
30
+ svc._claim(ctrl)
31
+ try:
32
+ await ctrl._initialize(
33
+ system_settings=v2.system_v2_to_settings(
34
+ SAMPLE_SYSTEM_V2["SystemV2"], ctrl.device_uid
35
+ )
36
+ )
37
+ ctrl.sent.clear()
38
+ yield ctrl
39
+ finally:
40
+ await ctrl.close()
41
+ await svc.close()
42
+
43
+
44
+ def _v1(service: MockDiscoveryService) -> MockController:
45
+ return cast(MockController, service._controller("000000001"))
46
+
47
+
48
+ @pytest.mark.parametrize(
49
+ ("field", "value", "expected"),
50
+ [
51
+ pytest.param("NoOfZones", 7, (8, 7), id="zone_count"),
52
+ pytest.param("NoOfConst", 2, (1, 2), id="const_count"),
53
+ pytest.param("SysType", "310", ("320", "310"), id="sys_type"),
54
+ pytest.param("FanAuto", "disabled", ("3-speed", "disabled"), id="fan_auto"),
55
+ ],
56
+ )
57
+ @pytest.mark.asyncio
58
+ async def test_vital_field_change_latches(
59
+ service: MockDiscoveryService, field: str, value: Any, expected: tuple
60
+ ) -> None:
61
+ controller = _v1(service)
62
+ controller.resources["SystemSettings"][field] = value
63
+
64
+ with pytest.raises(DeviceReconfigurationError) as err:
65
+ await controller.refresh_system()
66
+
67
+ assert err.value.changes == {field: expected}
68
+ assert controller.dump_state()["reconfigured"] == {field: expected}
69
+
70
+
71
+ @pytest.mark.asyncio
72
+ async def test_missing_fan_auto_matches_disabled() -> None:
73
+ svc = MockDiscoveryService()
74
+ controller = MockController(
75
+ svc,
76
+ device_uid="000000001",
77
+ device_ip="8.8.8.8",
78
+ is_v2=False,
79
+ is_ipower=False,
80
+ )
81
+ del controller.resources["SystemSettings"]["FanAuto"]
82
+ svc._claim(controller)
83
+ await controller._initialize(
84
+ system_settings=deepcopy(controller.resources["SystemSettings"])
85
+ )
86
+ # Fan modes read an absent FanAuto as disabled, so the check must too.
87
+ controller.resources["SystemSettings"]["FanAuto"] = "disabled"
88
+
89
+ await controller.refresh_system()
90
+
91
+ assert controller._reconfigured is None
92
+ await svc.close()
93
+
94
+
95
+ @pytest.mark.asyncio
96
+ async def test_faulted_read_does_not_latch(service: MockDiscoveryService) -> None:
97
+ controller = _v1(service)
98
+ settings = controller.resources["SystemSettings"]
99
+ settings["NoOfConst"] = 3
100
+ settings["UnitType"] = "error"
101
+
102
+ await controller.refresh_system()
103
+
104
+ assert controller._reconfigured is None
105
+ settings["UnitType"] = "Panasonic/Toshiba"
106
+ with pytest.raises(DeviceReconfigurationError):
107
+ await controller.refresh_system()
108
+
109
+
110
+ @pytest.mark.asyncio
111
+ async def test_unchanged_refresh_does_not_latch(service: MockDiscoveryService) -> None:
112
+ controller = _v1(service)
113
+
114
+ await controller.refresh_all()
115
+ await controller.refresh_all()
116
+
117
+ assert controller._reconfigured is None
118
+
119
+
120
+ @pytest.mark.parametrize(
121
+ ("zone_type", "latched"),
122
+ [
123
+ pytest.param("opcl", True, id="type_changed"),
124
+ pytest.param("error", False, id="type_faulted"),
125
+ ],
126
+ )
127
+ @pytest.mark.asyncio
128
+ async def test_zone_type_change_latches(
129
+ service: MockDiscoveryService, zone_type: str, latched: bool
130
+ ) -> None:
131
+ controller = _v1(service)
132
+ controller.resources["Zones1_4"][2]["Type"] = zone_type
133
+
134
+ if latched:
135
+ with pytest.raises(DeviceReconfigurationError) as err:
136
+ await controller.refresh_zones()
137
+ assert err.value.changes == {"Zone 3 Type": ("auto", "opcl")}
138
+ else:
139
+ await controller.refresh_zones()
140
+ assert controller._reconfigured is None
141
+
142
+
143
+ @pytest.mark.asyncio
144
+ async def test_latched_controller_raises_before_io(
145
+ service: MockDiscoveryService,
146
+ ) -> None:
147
+ controller = _v1(service)
148
+ controller.resources["SystemSettings"]["NoOfZones"] = 7
149
+ with pytest.raises(DeviceReconfigurationError):
150
+ await controller.refresh_system()
151
+ get = AsyncMock(wraps=controller._http_get)
152
+ controller._http_get = get # type: ignore[method-assign]
153
+ controller.sent.clear()
154
+
155
+ with pytest.raises(DeviceReconfigurationError):
156
+ await controller.refresh_all()
157
+ with pytest.raises(DeviceReconfigurationError):
158
+ await controller.set_on(False)
159
+ with pytest.raises(DeviceReconfigurationError):
160
+ await controller.zones[0].set_temp_setpoint(22.0)
161
+
162
+ get.assert_not_awaited()
163
+ assert controller.sent == []
164
+
165
+
166
+ @pytest.mark.asyncio
167
+ async def test_v1_reconfigure_outranks_zone_error(
168
+ service: MockDiscoveryService,
169
+ ) -> None:
170
+ controller = _v1(service)
171
+ controller.resources["SystemSettings"]["NoOfZones"] = 4
172
+ del controller.resources["Zones5_8"]
173
+
174
+ with pytest.raises(DeviceReconfigurationError) as err:
175
+ await controller.refresh_all()
176
+
177
+ assert err.value.changes == {"NoOfZones": (8, 4)}
178
+ assert isinstance(err.value.__cause__, ConnectionError)
179
+
180
+
181
+ @pytest.mark.asyncio
182
+ async def test_v2_reconfigure_raises_before_zone_requests(
183
+ v2_controller: MockController,
184
+ ) -> None:
185
+ cast(dict, v2_controller.v2_system)["SystemV2"]["NoOfZones"] = 1
186
+
187
+ with pytest.raises(DeviceReconfigurationError) as err:
188
+ await v2_controller.refresh_all()
189
+
190
+ assert err.value.changes == {"NoOfZones": (2, 1)}
191
+ assert [item[1]["iZoneV2Request"]["Type"] for item in v2_controller.sent] == [1]
192
+
193
+
194
+ @pytest.mark.asyncio
195
+ async def test_v2_zone_type_change_latches(v2_controller: MockController) -> None:
196
+ v2_controller.v2_zones[1]["ZonesV2"]["ZoneType"] = 3
197
+
198
+ with pytest.raises(DeviceReconfigurationError) as err:
199
+ await v2_controller.refresh_zones()
200
+
201
+ assert err.value.changes == {"Zone 2 Type": ("opcl", "auto")}
202
+
203
+
204
+ @pytest.mark.asyncio
205
+ async def test_command_whose_confirm_read_latches_still_returns(
206
+ service: MockDiscoveryService,
207
+ ) -> None:
208
+ controller = _v1(service)
209
+ controller.resources["SystemSettings"]["NoOfZones"] = 7
210
+
211
+ await controller.set_on(False)
212
+
213
+ assert controller._reconfigured == {"NoOfZones": (8, 7)}
214
+ with pytest.raises(DeviceReconfigurationError):
215
+ await controller.set_on(True)
216
+
217
+
218
+ @pytest.mark.asyncio
219
+ async def test_confirm_loop_stops_when_latched(v2_controller: MockController) -> None:
220
+ v2_controller.ZONE_CONFIRM_DELAY = 0.01
221
+ v2_controller.ZONE_CONFIRM_INTERVAL = 0.01
222
+ await v2_controller.zones[0].set_mode(v2_controller.zones[0].Mode.CLOSE)
223
+ v2_controller._reconfigured = {"NoOfZones": (2, 1)}
224
+ read = AsyncMock(wraps=v2_controller._v2_request)
225
+ v2_controller._v2_request = read # type: ignore[method-assign]
226
+ v2_controller._zone_confirm_wake.set()
227
+
228
+ task = v2_controller._zone_confirm_task
229
+ assert task is not None
230
+ await asyncio.wait_for(task, 2)
231
+
232
+ read.assert_not_awaited()
233
+
234
+
235
+ @pytest.mark.asyncio
236
+ async def test_recreated_controller_is_not_latched() -> None:
237
+ svc = MockDiscoveryService()
238
+ controller = await add_mock_controller(svc, "000000001", "8.8.8.8")
239
+ controller.resources["SystemSettings"]["NoOfZones"] = 4
240
+ with pytest.raises(DeviceReconfigurationError):
241
+ await controller.refresh_system()
242
+
243
+ await controller.close()
244
+ fresh = MockController(
245
+ svc,
246
+ device_uid="000000001",
247
+ device_ip="8.8.8.8",
248
+ is_v2=False,
249
+ is_ipower=False,
250
+ )
251
+ fresh.resources["SystemSettings"]["NoOfZones"] = 4
252
+ svc._claim(fresh)
253
+ await fresh._initialize(system_settings=fresh.resources["SystemSettings"])
254
+
255
+ await fresh.refresh_all()
256
+
257
+ assert fresh._reconfigured is None
258
+ assert len(fresh.zones) == 4
259
+ await svc.close()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes