PyPlumIO 0.5.18__py3-none-any.whl → 0.5.20__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 (60) hide show
  1. {PyPlumIO-0.5.18.dist-info → PyPlumIO-0.5.20.dist-info}/METADATA +8 -8
  2. PyPlumIO-0.5.20.dist-info/RECORD +61 -0
  3. pyplumio/__init__.py +1 -0
  4. pyplumio/__main__.py +1 -0
  5. pyplumio/_version.py +2 -2
  6. pyplumio/connection.py +2 -4
  7. pyplumio/const.py +1 -0
  8. pyplumio/devices/__init__.py +31 -22
  9. pyplumio/devices/ecomax.py +3 -11
  10. pyplumio/devices/ecoster.py +1 -0
  11. pyplumio/devices/mixer.py +1 -0
  12. pyplumio/devices/thermostat.py +1 -0
  13. pyplumio/exceptions.py +1 -0
  14. pyplumio/filters.py +8 -10
  15. pyplumio/frames/__init__.py +35 -28
  16. pyplumio/frames/messages.py +1 -0
  17. pyplumio/frames/requests.py +1 -0
  18. pyplumio/frames/responses.py +1 -0
  19. pyplumio/helpers/data_types.py +1 -0
  20. pyplumio/helpers/event_manager.py +1 -5
  21. pyplumio/helpers/factory.py +10 -3
  22. pyplumio/helpers/parameter.py +1 -0
  23. pyplumio/helpers/schedule.py +11 -7
  24. pyplumio/helpers/task_manager.py +1 -0
  25. pyplumio/helpers/timeout.py +7 -20
  26. pyplumio/helpers/typing.py +1 -0
  27. pyplumio/helpers/uid.py +1 -0
  28. pyplumio/protocol.py +63 -81
  29. pyplumio/stream.py +41 -38
  30. pyplumio/structures/__init__.py +1 -0
  31. pyplumio/structures/alerts.py +1 -0
  32. pyplumio/structures/boiler_load.py +1 -0
  33. pyplumio/structures/boiler_power.py +1 -0
  34. pyplumio/structures/ecomax_parameters.py +8 -8
  35. pyplumio/structures/fan_power.py +1 -0
  36. pyplumio/structures/frame_versions.py +1 -0
  37. pyplumio/structures/fuel_consumption.py +1 -0
  38. pyplumio/structures/fuel_level.py +1 -0
  39. pyplumio/structures/lambda_sensor.py +1 -0
  40. pyplumio/structures/mixer_parameters.py +11 -13
  41. pyplumio/structures/mixer_sensors.py +1 -0
  42. pyplumio/structures/modules.py +1 -0
  43. pyplumio/structures/network_info.py +1 -0
  44. pyplumio/structures/output_flags.py +1 -0
  45. pyplumio/structures/outputs.py +1 -0
  46. pyplumio/structures/pending_alerts.py +1 -0
  47. pyplumio/structures/product_info.py +1 -0
  48. pyplumio/structures/program_version.py +3 -2
  49. pyplumio/structures/regulator_data.py +3 -4
  50. pyplumio/structures/regulator_data_schema.py +1 -0
  51. pyplumio/structures/schedules.py +14 -11
  52. pyplumio/structures/statuses.py +1 -0
  53. pyplumio/structures/temperatures.py +1 -0
  54. pyplumio/structures/thermostat_parameters.py +17 -22
  55. pyplumio/structures/thermostat_sensors.py +1 -0
  56. pyplumio/utils.py +1 -0
  57. PyPlumIO-0.5.18.dist-info/RECORD +0 -61
  58. {PyPlumIO-0.5.18.dist-info → PyPlumIO-0.5.20.dist-info}/LICENSE +0 -0
  59. {PyPlumIO-0.5.18.dist-info → PyPlumIO-0.5.20.dist-info}/WHEEL +0 -0
  60. {PyPlumIO-0.5.18.dist-info → PyPlumIO-0.5.20.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
1
1
  """Contains a program version decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from dataclasses import dataclass
@@ -23,9 +24,9 @@ class VersionInfo:
23
24
  """Represents a version info provided in program version response."""
24
25
 
25
26
  software: str = SOFTWARE_VERSION
26
- struct_tag: bytes = b"\xFF\xFF"
27
+ struct_tag: bytes = b"\xff\xff"
27
28
  struct_version: int = 5
28
- device_id: bytes = b"\x7A\x00"
29
+ device_id: bytes = b"\x7a\x00"
29
30
  processor_signature: bytes = b"\x00\x00\x00"
30
31
 
31
32
 
@@ -1,9 +1,9 @@
1
1
  """Contains a regulator data structure decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from typing import Any, Final
5
6
 
6
- from pyplumio.devices import AddressableDevice
7
7
  from pyplumio.helpers.data_types import BitArray, DataType
8
8
  from pyplumio.structures import StructureDecoder
9
9
  from pyplumio.structures.frame_versions import FrameVersionsStructure
@@ -55,9 +55,8 @@ class RegulatorDataStructure(StructureDecoder):
55
55
  message, offset + 2, data
56
56
  )
57
57
 
58
- sender = self.frame.sender
59
- if isinstance(sender, AddressableDevice) and (
60
- schema := sender.get_nowait(ATTR_REGDATA_SCHEMA, [])
58
+ if (device := self.frame.sender_device) is not None and (
59
+ schema := device.get_nowait(ATTR_REGDATA_SCHEMA, [])
61
60
  ):
62
61
  self._bitarray_index = 0
63
62
  data[ATTR_REGDATA] = {
@@ -1,4 +1,5 @@
1
1
  """Contains data schema structure decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from typing import Any, Final
@@ -1,17 +1,23 @@
1
1
  """Contains schedule decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from collections.abc import Sequence
5
6
  from dataclasses import dataclass
6
7
  from functools import reduce
7
8
  from itertools import chain
8
- from typing import Any, Final, cast
9
-
10
- from pyplumio.const import ATTR_PARAMETER, ATTR_SCHEDULE, ATTR_SWITCH, ATTR_TYPE
9
+ from typing import Any, Final
10
+
11
+ from pyplumio.const import (
12
+ ATTR_PARAMETER,
13
+ ATTR_SCHEDULE,
14
+ ATTR_SWITCH,
15
+ ATTR_TYPE,
16
+ FrameType,
17
+ )
11
18
  from pyplumio.devices import AddressableDevice, Device
12
19
  from pyplumio.exceptions import FrameDataError
13
20
  from pyplumio.frames import Request
14
- from pyplumio.helpers.factory import create_instance
15
21
  from pyplumio.helpers.parameter import (
16
22
  BinaryParameter,
17
23
  BinaryParameterDescription,
@@ -84,13 +90,10 @@ class ScheduleParameter(Parameter):
84
90
  async def create_request(self) -> Request:
85
91
  """Create a request to change the parameter."""
86
92
  schedule_name, _ = self.description.name.split("_schedule_", 1)
87
- return cast(
88
- Request,
89
- await create_instance(
90
- "frames.requests.SetScheduleRequest",
91
- recipient=self.device.address,
92
- data=collect_schedule_data(schedule_name, self.device),
93
- ),
93
+ return await Request.create(
94
+ FrameType.REQUEST_SET_SCHEDULE,
95
+ recipient=self.device.address,
96
+ data=collect_schedule_data(schedule_name, self.device),
94
97
  )
95
98
 
96
99
 
@@ -1,4 +1,5 @@
1
1
  """Contains a statuses structure decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from typing import Any, Final
@@ -1,4 +1,5 @@
1
1
  """Contains a temperatures structure decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  import math
@@ -1,20 +1,20 @@
1
1
  """Contains a thermostat parameters structure decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from collections.abc import Generator
5
6
  from dataclasses import dataclass
6
- from typing import TYPE_CHECKING, Any, Final, cast
7
+ from typing import TYPE_CHECKING, Any, Final
7
8
 
8
9
  from pyplumio.const import (
9
10
  ATTR_INDEX,
10
11
  ATTR_OFFSET,
11
12
  ATTR_SIZE,
12
13
  ATTR_VALUE,
14
+ FrameType,
13
15
  UnitOfMeasurement,
14
16
  )
15
- from pyplumio.devices import AddressableDevice
16
17
  from pyplumio.frames import Request
17
- from pyplumio.helpers.factory import create_instance
18
18
  from pyplumio.helpers.parameter import (
19
19
  BinaryParameter,
20
20
  BinaryParameterDescription,
@@ -61,20 +61,17 @@ class ThermostatParameter(Parameter):
61
61
 
62
62
  async def create_request(self) -> Request:
63
63
  """Create a request to change the parameter."""
64
- return cast(
65
- Request,
66
- await create_instance(
67
- "frames.requests.SetThermostatParameterRequest",
68
- recipient=self.device.parent.address,
69
- data={
70
- # Increase the index by one to account for thermostat
71
- # profile, which is being set at ecoMAX device level.
72
- ATTR_INDEX: self._index + 1,
73
- ATTR_VALUE: self.values.value,
74
- ATTR_OFFSET: self.offset,
75
- ATTR_SIZE: self.description.size,
76
- },
77
- ),
64
+ return await Request.create(
65
+ FrameType.REQUEST_SET_THERMOSTAT_PARAMETER,
66
+ recipient=self.device.parent.address,
67
+ data={
68
+ # Increase the index by one to account for thermostat
69
+ # profile, which is being set at ecoMAX device level.
70
+ ATTR_INDEX: self._index + 1,
71
+ ATTR_VALUE: self.values.value,
72
+ ATTR_OFFSET: self.offset,
73
+ ATTR_SIZE: self.description.size,
74
+ },
78
75
  )
79
76
 
80
77
  async def set(self, value: ParameterValueType, retries: int = 5) -> bool:
@@ -216,11 +213,9 @@ class ThermostatParametersStructure(StructureDecoder):
216
213
  self, message: bytearray, offset: int = 0, data: dict[str, Any] | None = None
217
214
  ) -> tuple[dict[str, Any], int]:
218
215
  """Decode bytes and return message data and offset."""
219
- sender = self.frame.sender
220
- if (
221
- isinstance(sender, AddressableDevice)
222
- and (thermostats := sender.get_nowait(ATTR_THERMOSTATS_AVAILABLE, 0)) == 0
223
- ):
216
+ if (device := self.frame.sender_device) is not None and (
217
+ thermostats := device.get_nowait(ATTR_THERMOSTATS_AVAILABLE, 0)
218
+ ) == 0:
224
219
  return (
225
220
  ensure_dict(data, {ATTR_THERMOSTAT_PARAMETERS: None}),
226
221
  offset,
@@ -1,4 +1,5 @@
1
1
  """Contains a thermostat sensors structure decoder."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from collections.abc import Generator
pyplumio/utils.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Contains various utility methods."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from typing import Any
@@ -1,61 +0,0 @@
1
- pyplumio/__init__.py,sha256=4v9BaIkJ440qu2ITrcwVLOg9KO8k2W1gnGHe86sDLM8,3292
2
- pyplumio/__main__.py,sha256=oop76iR-XDHhMFhW4LO8-xTnBHsqzUQ5VVh__94OaqY,499
3
- pyplumio/_version.py,sha256=TJSWAybqN12Cw_kxmDDEn4jE4KWfkCe6C38YXdi-hN8,413
4
- pyplumio/connection.py,sha256=0PmpNOcV7RgSfEeM7Wnhtbw0TpdtMTyqpJPQ2h7IX9M,6199
5
- pyplumio/const.py,sha256=4_VRx5mY7qf5fwaUluVlhuK_NIb7bClzhnhRLA-3GkY,3914
6
- pyplumio/exceptions.py,sha256=3tgfe0GD-T-DV2TUybsv7dwsk9P9f2g-4Gd8jnXw6DI,698
7
- pyplumio/filters.py,sha256=kXR4SUS7YXGaljW35NpEB9prHgxDKpsf_U1ACMTnh5I,11174
8
- pyplumio/protocol.py,sha256=btBJiCyB2ys-tiQOm8kj97_Y7yesO4cIOKrEGbrCrsk,8787
9
- pyplumio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- pyplumio/stream.py,sha256=UPqlUmNBobSS4SvS5BI19g_FeSTLpLj1k3l7OeE32bI,4374
11
- pyplumio/utils.py,sha256=h46IS7hOHFbAFGGmnyAUVwlfk0m_eSwa3U8oZq6-bJY,687
12
- pyplumio/devices/__init__.py,sha256=zw0DDvXLdASaMeTUMZog-osKhsugNpPMYU4dV1Jr4iU,6379
13
- pyplumio/devices/ecomax.py,sha256=cdPZ2LbUvH0l8hpwWxZiB570OloIpeilXWdHEDlixW4,16795
14
- pyplumio/devices/ecoster.py,sha256=QH68bzs199x9Id-wOY6J5WddyR69STNQi8SxaWDwKG4,312
15
- pyplumio/devices/mixer.py,sha256=a-1klZuEO7dLQfpdOor0vUZ9ksllf8D1w0AbMeGmE_g,2946
16
- pyplumio/devices/thermostat.py,sha256=CXHAWwqyDATcI8UYNcTv6TK3YHYDSUyHE3Txyy9fVAI,2401
17
- pyplumio/frames/__init__.py,sha256=p3YFapqx7q9KJt3KhmG4qKFmQqNu05Y7hK1k9B9tENY,7264
18
- pyplumio/frames/messages.py,sha256=hZn8mvPuSw4kD7EL8Xtroh1sDZe6CqLc5HyvctMzGMc,3616
19
- pyplumio/frames/requests.py,sha256=F64kJ29jLfyy1YRqWLVTqib5MALGeB72NY8-kAx42IY,7220
20
- pyplumio/frames/responses.py,sha256=7MHwXkNVTcwYpWRAXBMiPxmaJw3vgX9kgoaBTXeRy60,6531
21
- pyplumio/helpers/__init__.py,sha256=H2xxdkF-9uADLwEbfBUoxNTdwru3L5Z2cfJjgsuRsn0,31
22
- pyplumio/helpers/data_types.py,sha256=UIbJu0JfXaNCiHlg8EnYOfeyKq9Mxiu6j_D8GyRudZk,8211
23
- pyplumio/helpers/event_manager.py,sha256=E9gMGCxOOBNZgnHCwpb8rtFgKsNIkjHvIN73XBgwQDk,6004
24
- pyplumio/helpers/factory.py,sha256=Ld_PbKnkj0HFnuYcoDwcitiMRa-88UQKXcsE5vdgLqs,824
25
- pyplumio/helpers/parameter.py,sha256=ihdom_tON2urYXmS7x_2-zk2I-PcogdjILE7tOiGR8M,8698
26
- pyplumio/helpers/schedule.py,sha256=395yTDAKV43so5vEG-q0mgqXGoFVWKpIyhdmqzKT-X4,4958
27
- pyplumio/helpers/task_manager.py,sha256=P17Nw9HDbA9NMSdkJo2WQRbEsykzzFSwQyyRzI3uFPk,1089
28
- pyplumio/helpers/timeout.py,sha256=bWBWvLPpgjCvdG5hlrSTXok_CsLme-jGnY9rHwupRc0,1286
29
- pyplumio/helpers/typing.py,sha256=V3uYCMyC4oePM7YzL0S-xEsyTgjgDbkOM0VNe-1LBPo,684
30
- pyplumio/helpers/uid.py,sha256=FTwuET3WLNyEkAHpxD4ZA3hu-l_JCS6pq12xibAQs6s,974
31
- pyplumio/structures/__init__.py,sha256=-nbLcQvbWcs2EmnChqJmMVo1CUfj8lqMHb8yK1mV4j8,1298
32
- pyplumio/structures/alerts.py,sha256=v--wbEKoB07r9KHMuZgMRT1dk4r8dPwxxB5cPv4lzZY,3259
33
- pyplumio/structures/boiler_load.py,sha256=HVPKt53VWvp2KDuSK1B9kcpX1h3Bz3GPBqBI4Oscm2Q,837
34
- pyplumio/structures/boiler_power.py,sha256=tP00IMz5qVQaePr70uTz_jCLoXHnmj_g3pvKxdNvenc,900
35
- pyplumio/structures/ecomax_parameters.py,sha256=Ywiabk0panLHSScv8SZC_cBmkdSXuXPEfDFyEsjR0ts,25895
36
- pyplumio/structures/fan_power.py,sha256=fGU_BTPTtAplnjmTQQHhMXdoiHVYOdLlZ_PDA9F5u9c,870
37
- pyplumio/structures/frame_versions.py,sha256=9lFnrlxkok_3CTbXz38cntacnubWYGcaubDnYq9NOAM,1559
38
- pyplumio/structures/fuel_consumption.py,sha256=H23GVw9s0fbURvJHAfReTEvGp5q-oPOidh1mToOO3ec,975
39
- pyplumio/structures/fuel_level.py,sha256=27QfxB_LXAREmHs7q8KyohpLbagLUZolCQoZJUDTPz0,1068
40
- pyplumio/structures/lambda_sensor.py,sha256=JdKHWN2RcMgCXhMZ0IhYCYrHWnw2TgsR-iitLn7QLe0,1586
41
- pyplumio/structures/mixer_parameters.py,sha256=UsOey8D5d7rrUACwOcoBB_x2lHQYKC2Xsoxqcpf6DG4,8380
42
- pyplumio/structures/mixer_sensors.py,sha256=f6BjpX-ENGlKIDOOWUHMlb0TZ5HMYD9dIkRoSvgRXHg,2259
43
- pyplumio/structures/modules.py,sha256=t332XxB-6dTtDbY9mNuqTqb21zDy2XG_17pmWgJfGvw,2519
44
- pyplumio/structures/network_info.py,sha256=pLbCB5Z8nCB6efb6ZZImw3TaVAOB3Af5K1z9vVbuGgo,4054
45
- pyplumio/structures/output_flags.py,sha256=QWF_HEylx6jYHFW72ILRbfCgx375KSCr7IBLSCcjVBE,1344
46
- pyplumio/structures/outputs.py,sha256=hW6w2jF9Elr7J-8my42f6g2Mdsn65qwXVv23tHtZQf8,1915
47
- pyplumio/structures/pending_alerts.py,sha256=axAyjedD5r4oKy-B628RA4DEHQAxmJQGwBVpsmNjJHo,738
48
- pyplumio/structures/product_info.py,sha256=Os0AS88geH2JqvVRC2zQxEucmGJoDzR3ed3PlPTJFTw,2408
49
- pyplumio/structures/program_version.py,sha256=WX5tM3X3aaJCjNd5rsAN6EXivBXM-kLXQvhfQR8wKIM,2358
50
- pyplumio/structures/regulator_data.py,sha256=9d7fGcZ1SI2QosUQSd0CpPqaHpgXihqV5-QgHWGzkNU,2379
51
- pyplumio/structures/regulator_data_schema.py,sha256=5uwdw8nCqSX9Ex5jH9t4pghj6fLRRsCnGQx69LVGAy0,1504
52
- pyplumio/structures/schedules.py,sha256=j7kuT7gYesFKJJ4yMrW6JVO0aJX9O6PT2D_PTCQre04,6441
53
- pyplumio/structures/statuses.py,sha256=zjDQTU5fdORRzRkvlkzplgVS8A3AdyHG2qihfkdOHIM,1165
54
- pyplumio/structures/temperatures.py,sha256=O8rANFN-wz5NvTWqh_25oUfFajjVyI9hoOMmz8vkKHg,2336
55
- pyplumio/structures/thermostat_parameters.py,sha256=1SJzHguN12JE-e2utwA448VgUkFddQxBQy3m66qCobk,7934
56
- pyplumio/structures/thermostat_sensors.py,sha256=N9nm3Rp1Rhb8wUPUkJIX56olZztixoxyFxIxP4R5P2g,3176
57
- PyPlumIO-0.5.18.dist-info/LICENSE,sha256=m-UuZFjXJ22uPTGm9kSHS8bqjsf5T8k2wL9bJn1Y04o,1088
58
- PyPlumIO-0.5.18.dist-info/METADATA,sha256=fHzLAiOHlj3nYHmvnm4OZsFBUMyJcSnSgmRg7zbbr0s,5415
59
- PyPlumIO-0.5.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
60
- PyPlumIO-0.5.18.dist-info/top_level.txt,sha256=kNBz9UPPkPD9teDn3U_sEy5LjzwLm9KfADCXtBlbw8A,9
61
- PyPlumIO-0.5.18.dist-info/RECORD,,