PyPlumIO 0.7.2__tar.gz → 0.7.3__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 (131) hide show
  1. {pyplumio-0.7.2 → pyplumio-0.7.3}/PKG-INFO +1 -1
  2. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/const.py +2 -0
  3. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/devices/ecomax.py +15 -5
  4. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/filters.py +8 -12
  5. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/helpers/async_cache.py +6 -3
  6. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/parameters/ecomax.py +8 -0
  7. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyproject.toml +1 -1
  8. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/devices/test_ecomax.py +9 -6
  9. {pyplumio-0.7.2 → pyplumio-0.7.3}/.gitignore +0 -0
  10. {pyplumio-0.7.2 → pyplumio-0.7.3}/LICENSE +0 -0
  11. {pyplumio-0.7.2 → pyplumio-0.7.3}/README.md +0 -0
  12. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/Makefile +0 -0
  13. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/make.bat +0 -0
  14. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/callbacks.rst +0 -0
  15. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/conf.py +0 -0
  16. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/connecting.rst +0 -0
  17. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/frames.rst +0 -0
  18. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/index.rst +0 -0
  19. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/mixers_thermostats.rst +0 -0
  20. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/protocol.rst +0 -0
  21. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/reading.rst +0 -0
  22. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/schedules.rst +0 -0
  23. {pyplumio-0.7.2 → pyplumio-0.7.3}/docs/source/writing.rst +0 -0
  24. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/__init__.py +0 -0
  25. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/__main__.py +0 -0
  26. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/connection.py +0 -0
  27. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/data_types.py +0 -0
  28. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/devices/__init__.py +0 -0
  29. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/devices/ecoster.py +0 -0
  30. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/devices/mixer.py +0 -0
  31. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/devices/thermostat.py +0 -0
  32. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/exceptions.py +0 -0
  33. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/frames/__init__.py +0 -0
  34. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/frames/messages.py +0 -0
  35. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/frames/requests.py +0 -0
  36. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/frames/responses.py +0 -0
  37. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/helpers/__init__.py +0 -0
  38. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/helpers/event_manager.py +0 -0
  39. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/helpers/task_manager.py +0 -0
  40. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/parameters/__init__.py +0 -0
  41. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/parameters/custom/__init__.py +0 -0
  42. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/parameters/custom/ecomax_860d3_hb.py +0 -0
  43. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/parameters/mixer.py +0 -0
  44. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/parameters/thermostat.py +0 -0
  45. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/protocol.py +0 -0
  46. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/py.typed +0 -0
  47. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/stream.py +0 -0
  48. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/__init__.py +0 -0
  49. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/alerts.py +0 -0
  50. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/ecomax_extended_parameters.py +0 -0
  51. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/ecomax_parameters.py +0 -0
  52. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/frame_versions.py +0 -0
  53. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/mixer_parameters.py +0 -0
  54. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/network_info.py +0 -0
  55. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/product_info.py +0 -0
  56. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/program_version.py +0 -0
  57. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/regulator_data.py +0 -0
  58. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/regulator_data_schema.py +0 -0
  59. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/schedules.py +0 -0
  60. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/sensor_data.py +0 -0
  61. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/structures/thermostat_parameters.py +0 -0
  62. {pyplumio-0.7.2 → pyplumio-0.7.3}/pyplumio/utils.py +0 -0
  63. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/__init__.py +0 -0
  64. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/conftest.py +0 -0
  65. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/devices/__init__.py +0 -0
  66. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/devices/test_ecoster.py +0 -0
  67. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/devices/test_init.py +0 -0
  68. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/devices/test_mixer.py +0 -0
  69. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/devices/test_thermostat.py +0 -0
  70. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/frames/test_init.py +0 -0
  71. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/frames/test_messages.py +0 -0
  72. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/frames/test_requests.py +0 -0
  73. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/frames/test_responses.py +0 -0
  74. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/helpers/__init__.py +0 -0
  75. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/helpers/test_async_cache.py +0 -0
  76. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/helpers/test_event_manager.py +0 -0
  77. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/helpers/test_task_manager.py +0 -0
  78. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/helpers/test_uid.py +0 -0
  79. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/__init__.py +0 -0
  80. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/custom/__init__.py +0 -0
  81. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/custom/test_ecomax_860d3_hb.py +0 -0
  82. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/custom/test_init.py +0 -0
  83. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/test_ecomax.py +0 -0
  84. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/test_init.py +0 -0
  85. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/test_mixers.py +0 -0
  86. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/parameters/test_thermostats.py +0 -0
  87. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/ruff.toml +0 -0
  88. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/__init__.py +0 -0
  89. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_alerts.py +0 -0
  90. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_ecomax_extended_parameters.py +0 -0
  91. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_ecomax_parameters.py +0 -0
  92. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_frame_versions.py +0 -0
  93. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_mixer_parameters.py +0 -0
  94. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_product_info.py +0 -0
  95. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_program_version.py +0 -0
  96. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/structures/test_schedules.py +0 -0
  97. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_connection.py +0 -0
  98. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_data_types.py +0 -0
  99. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_filters.py +0 -0
  100. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_init.py +0 -0
  101. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_main.py +0 -0
  102. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_protocol.py +0 -0
  103. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_stream.py +0 -0
  104. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/test_utils.py +0 -0
  105. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/messages/regulator_data.json +0 -0
  106. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/messages/sensor_data.json +0 -0
  107. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/parameters/ecomax_860d3_hb.json +0 -0
  108. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/alerts.json +0 -0
  109. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/ecomax_control.json +0 -0
  110. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/ecomax_extended_parameters.json +0 -0
  111. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/ecomax_parameters.json +0 -0
  112. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/mixer_parameters.json +0 -0
  113. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/set_ecomax_extended_parameter.json +0 -0
  114. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/set_ecomax_parameter.json +0 -0
  115. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/set_mixer_parameter.json +0 -0
  116. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/set_schedule.json +0 -0
  117. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/set_thermostat_parameter.json +0 -0
  118. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/requests/thermostat_parameters.json +0 -0
  119. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/alerts.json +0 -0
  120. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/device_available.json +0 -0
  121. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/ecomax_extended_parameters.json +0 -0
  122. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/ecomax_parameters.json +0 -0
  123. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/mixer_parameters.json +0 -0
  124. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/password.json +0 -0
  125. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/program_version.json +0 -0
  126. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/regulator_data_schema.json +0 -0
  127. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/schedules.json +0 -0
  128. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/thermostat_parameters.json +0 -0
  129. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/responses/uid.json +0 -0
  130. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/unknown/unknown_ecomax_parameter.json +0 -0
  131. {pyplumio-0.7.2 → pyplumio-0.7.3}/tests/testdata/unknown/unknown_mixer_parameter.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: PyPlumIO
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: PyPlumIO is a native ecoNET library for Plum ecoMAX controllers.
5
5
  Project-URL: Documentation, https://pyplumio.denpa.pro
6
6
  Project-URL: Source Code, https://github.com/denpamusic/PyPlumIO
@@ -26,6 +26,8 @@ ATTR_SIZE: Final = "size"
26
26
  # Bytes.
27
27
  BYTE_UNDEFINED: Final = 0xFF
28
28
 
29
+ UNDEFINED: Final = object()
30
+
29
31
 
30
32
  @unique
31
33
  class EncryptionType(IntEnum):
@@ -30,13 +30,13 @@ from pyplumio.helpers.event_manager import event_listener
30
30
  from pyplumio.parameters import ParameterValues
31
31
  from pyplumio.parameters.ecomax import (
32
32
  ECOMAX_CONTROL_PARAMETER,
33
- EXTENDED_PARAMETER_TYPES,
34
33
  THERMOSTAT_PROFILE_PARAMETER,
35
34
  EcomaxExtendedNumber,
36
35
  EcomaxNumber,
37
36
  EcomaxSwitch,
38
37
  EcomaxSwitchDescription,
39
38
  get_ecomax_parameter_types,
39
+ get_extended_parameter_types,
40
40
  )
41
41
  from pyplumio.structures.alerts import ATTR_TOTAL_ALERTS
42
42
  from pyplumio.structures.ecomax_parameters import (
@@ -322,15 +322,25 @@ class EcoMAX(PhysicalDevice):
322
322
  """
323
323
  _LOGGER.debug("Received device extended parameters")
324
324
  product_info = await self.get(ATTR_PRODUCT)
325
- parameter_types = EXTENDED_PARAMETER_TYPES.get(
326
- (product_info.id, product_info.model), {}
327
- )
325
+ if not (parameter_types := get_extended_parameter_types(product_info)):
326
+ _LOGGER.debug(
327
+ "Encountered unknown ecoMAX extended parameter table. "
328
+ "Your device isn't fully compatible with this software "
329
+ "and may not work properly. Please visit the issue tracker "
330
+ "and open a feature request to support %s",
331
+ product_info.model,
332
+ )
333
+ return
334
+
328
335
  await asyncio.gather(
329
336
  *(
330
337
  self.dispatch(
331
338
  description.name,
332
339
  EcomaxExtendedNumber.create_or_update(
333
- device=self, description=description, values=values, index=index
340
+ device=self,
341
+ description=description,
342
+ values=values,
343
+ index=index,
334
344
  ),
335
345
  )
336
346
  for index, values in parameters
@@ -22,6 +22,7 @@ from typing import (
22
22
  runtime_checkable,
23
23
  )
24
24
 
25
+ from pyplumio.const import UNDEFINED
25
26
  from pyplumio.helpers.event_manager import EventCallback
26
27
  from pyplumio.parameters import Number, Parameter
27
28
 
@@ -35,9 +36,6 @@ with suppress(ImportError):
35
36
  numpy_installed = True
36
37
 
37
38
 
38
- UNDEFINED: Final = "undefined"
39
-
40
-
41
39
  @runtime_checkable
42
40
  class SupportsSubtraction(Protocol):
43
41
  """Supports subtraction operation."""
@@ -92,14 +90,12 @@ def is_close(
92
90
  return False
93
91
 
94
92
  if isinstance(old, Parameter) and isinstance(new, Parameter):
95
- if (
96
- tolerance
97
- and isinstance(old, Number)
98
- and isinstance(new, Number)
99
- and old.values.min_value == new.values.min_value
100
- and old.values.max_value == new.values.max_value
101
- ):
102
- return math.isclose(old, new, abs_tol=tolerance)
93
+ if tolerance and isinstance(old, Number) and isinstance(new, Number):
94
+ return (
95
+ old.values.min_value == new.values.min_value
96
+ and old.values.max_value == new.values.max_value
97
+ and math.isclose(old, new, abs_tol=tolerance)
98
+ )
103
99
 
104
100
  return old.values.__eq__(new.values)
105
101
 
@@ -432,7 +428,7 @@ class ComparisonFilter(Filter):
432
428
 
433
429
  def is_undefined(self) -> bool:
434
430
  """Check if current value is undefined."""
435
- return True if self._value == UNDEFINED else False
431
+ return self._value is UNDEFINED
436
432
 
437
433
  @property
438
434
  def value(self) -> Any:
@@ -7,6 +7,8 @@ from functools import wraps
7
7
  from types import MappingProxyType
8
8
  from typing import Any, ParamSpec, TypeVar, cast
9
9
 
10
+ from pyplumio.const import UNDEFINED
11
+
10
12
  T = TypeVar("T")
11
13
  P = ParamSpec("P")
12
14
 
@@ -24,10 +26,11 @@ class AsyncCache:
24
26
 
25
27
  async def get(self, key: str, coro: Callable[..., Awaitable[Any]]) -> Any:
26
28
  """Get a value from the cache or compute and store it."""
27
- if key not in self.cache:
28
- self._cache[key] = await coro()
29
+ if (cached_value := self._cache.get(key, UNDEFINED)) is not UNDEFINED:
30
+ return cached_value
29
31
 
30
- return self._cache[key]
32
+ self._cache[key] = cached_value = await coro()
33
+ return cached_value
31
34
 
32
35
  @property
33
36
  def cache(self) -> MappingProxyType[str, Any]:
@@ -1110,6 +1110,13 @@ async def get_ecomax_parameter_types(
1110
1110
  )
1111
1111
 
1112
1112
 
1113
+ def get_extended_parameter_types(
1114
+ product_info: ProductInfo,
1115
+ ) -> dict[int, EcomaxNumberDescription]:
1116
+ """Return extended ecoMAX parameter types for specific product."""
1117
+ return EXTENDED_PARAMETER_TYPES.get((product_info.id, product_info.model), {})
1118
+
1119
+
1113
1120
  __all__ = [
1114
1121
  "ATTR_ECOMAX_CONTROL",
1115
1122
  "EcomaxExtendedNumber",
@@ -1121,6 +1128,7 @@ __all__ = [
1121
1128
  "EcomaxSwitchDescription",
1122
1129
  "EXTENDED_PARAMETER_TYPES",
1123
1130
  "get_ecomax_parameter_types",
1131
+ "get_extended_parameter_types",
1124
1132
  "PARAMETER_TYPES",
1125
1133
  "THERMOSTAT_PROFILE_PARAMETER",
1126
1134
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyPlumIO"
3
- version = "0.7.2"
3
+ version = "0.7.3"
4
4
  authors = [
5
5
  {name = "Denis Paavilainen", email = "denpa@denpa.pro"}
6
6
  ]
@@ -504,17 +504,20 @@ async def test_set_ecomax_extended_parameter(
504
504
 
505
505
  @json_test_data("responses/ecomax_extended_parameters.json", selector="message")
506
506
  async def test_ecomax_extended_parameters_unknown_product(
507
- ecomax: EcoMAX, ecomax_extended_parameters_message: bytearray
507
+ ecomax: EcoMAX, caplog, ecomax_extended_parameters_message: bytearray
508
508
  ) -> None:
509
509
  """Test ecoMAX extended parameters for product without descriptions."""
510
- ecomax.handle_frame(
511
- EcomaxExtendedParametersResponse(
512
- message=bytes(ecomax_extended_parameters_message)
510
+ with caplog.at_level(logging.DEBUG):
511
+ ecomax.handle_frame(
512
+ EcomaxExtendedParametersResponse(
513
+ message=bytes(ecomax_extended_parameters_message)
514
+ )
513
515
  )
514
- )
515
- await ecomax.wait_until_done()
516
+ await ecomax.wait_until_done()
517
+
516
518
  assert len(ecomax.get_nowait(ATTR_ECOMAX_EXTENDED_PARAMETERS)) == 231
517
519
  assert "control_mode" not in ecomax.data
520
+ assert "Encountered unknown ecoMAX extended parameter table" in caplog.text
518
521
 
519
522
 
520
523
  @class_from_json(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes