plugwise 1.4.3__tar.gz → 1.4.4__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 (32) hide show
  1. {plugwise-1.4.3 → plugwise-1.4.4}/PKG-INFO +1 -1
  2. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/__init__.py +9 -8
  3. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/helper.py +3 -2
  4. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/legacy/helper.py +3 -2
  5. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/legacy/smile.py +2 -1
  6. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/smile.py +2 -1
  7. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise.egg-info/PKG-INFO +1 -1
  8. {plugwise-1.4.3 → plugwise-1.4.4}/pyproject.toml +1 -1
  9. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_init.py +10 -5
  10. {plugwise-1.4.3 → plugwise-1.4.4}/LICENSE +0 -0
  11. {plugwise-1.4.3 → plugwise-1.4.4}/README.md +0 -0
  12. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/common.py +0 -0
  13. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/constants.py +0 -0
  14. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/data.py +0 -0
  15. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/exceptions.py +0 -0
  16. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/legacy/data.py +0 -0
  17. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/py.typed +0 -0
  18. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise/util.py +0 -0
  19. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise.egg-info/SOURCES.txt +0 -0
  20. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise.egg-info/dependency_links.txt +0 -0
  21. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise.egg-info/requires.txt +0 -0
  22. {plugwise-1.4.3 → plugwise-1.4.4}/plugwise.egg-info/top_level.txt +0 -0
  23. {plugwise-1.4.3 → plugwise-1.4.4}/setup.cfg +0 -0
  24. {plugwise-1.4.3 → plugwise-1.4.4}/setup.py +0 -0
  25. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_adam.py +0 -0
  26. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_anna.py +0 -0
  27. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_generic.py +0 -0
  28. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_legacy_anna.py +0 -0
  29. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_legacy_generic.py +0 -0
  30. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_legacy_p1.py +0 -0
  31. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_legacy_stretch.py +0 -0
  32. {plugwise-1.4.3 → plugwise-1.4.4}/tests/test_p1.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plugwise
3
- Version: 1.4.3
3
+ Version: 1.4.4
4
4
  Summary: Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3.
5
5
  Home-page: https://github.com/plugwise/python-plugwise
6
6
  Author: Plugwise device owners
@@ -31,6 +31,7 @@ from plugwise.smile import SmileAPI
31
31
 
32
32
  import aiohttp
33
33
  from defusedxml import ElementTree as etree
34
+ from packaging.version import Version, parse
34
35
 
35
36
 
36
37
  class Smile(SmileComm):
@@ -75,7 +76,7 @@ class Smile(SmileComm):
75
76
  self._target_smile: str = NONE
76
77
  self.gateway_id: str = NONE
77
78
  self.loc_data: dict[str, ThermoLoc] = {}
78
- self.smile_fw_version: str | None = None
79
+ self.smile_fw_version: Version | None = None
79
80
  self.smile_hostname: str = NONE
80
81
  self.smile_hw_version: str | None = None
81
82
  self.smile_legacy = False
@@ -84,10 +85,10 @@ class Smile(SmileComm):
84
85
  self.smile_model_id: str | None = None
85
86
  self.smile_name: str = NONE
86
87
  self.smile_type: str = NONE
87
- self.smile_version: str = NONE
88
+ self.smile_version: Version | None = None
88
89
  self.smile_zigbee_mac_address: str | None = None
89
90
 
90
- async def connect(self) -> bool:
91
+ async def connect(self) -> Version | None:
91
92
  """Connect to Plugwise device and determine its name, type and version."""
92
93
  result = await self._request(DOMAIN_OBJECTS)
93
94
  # Work-around for Stretch fw 2.7.18
@@ -173,7 +174,7 @@ class Smile(SmileComm):
173
174
  # Update all endpoints on first connect
174
175
  await self._smile_api.full_update_device()
175
176
 
176
- return True
177
+ return self.smile_version
177
178
 
178
179
  async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
179
180
  """Helper-function for connect().
@@ -184,7 +185,7 @@ class Smile(SmileComm):
184
185
  if (gateway := result.find("./gateway")) is not None:
185
186
  if (v_model := gateway.find("vendor_model")) is not None:
186
187
  model = v_model.text
187
- self.smile_fw_version = gateway.find("firmware_version").text
188
+ self.smile_fw_version = parse(gateway.find("firmware_version").text)
188
189
  self.smile_hw_version = gateway.find("hardware_version").text
189
190
  self.smile_hostname = gateway.find("hostname").text
190
191
  self.smile_mac_address = gateway.find("mac_address").text
@@ -200,7 +201,7 @@ class Smile(SmileComm):
200
201
  )
201
202
  raise UnsupportedDeviceError
202
203
 
203
- version_major: str = self.smile_fw_version.split(".", 1)[0]
204
+ version_major= str(self.smile_fw_version.major)
204
205
  self._target_smile = f"{model}_v{version_major}"
205
206
  LOGGER.debug("Plugwise identified as %s", self._target_smile)
206
207
  if self._target_smile not in SMILES:
@@ -267,7 +268,7 @@ class Smile(SmileComm):
267
268
  or network is not None
268
269
  ):
269
270
  system = await self._request(SYSTEM)
270
- self.smile_fw_version = system.find("./gateway/firmware").text
271
+ self.smile_fw_version = parse(system.find("./gateway/firmware").text)
271
272
  return_model = system.find("./gateway/product").text
272
273
  self.smile_hostname = system.find("./gateway/hostname").text
273
274
  # If wlan0 contains data it's active, so eth0 should be checked last
@@ -278,7 +279,7 @@ class Smile(SmileComm):
278
279
  # P1 legacy:
279
280
  elif dsmrmain is not None:
280
281
  status = await self._request(STATUS)
281
- self.smile_fw_version = status.find("./system/version").text
282
+ self.smile_fw_version = parse(status.find("./system/version").text)
282
283
  return_model = status.find("./system/product").text
283
284
  self.smile_hostname = status.find("./network/hostname").text
284
285
  self.smile_mac_address = status.find("./network/mac_address").text
@@ -62,6 +62,7 @@ from dateutil import tz
62
62
  from dateutil.parser import parse
63
63
  from defusedxml import ElementTree as etree
64
64
  from munch import Munch
65
+ from packaging.version import Version
65
66
 
66
67
 
67
68
  class SmileComm:
@@ -250,7 +251,7 @@ class SmileHelper(SmileCommon):
250
251
  self.gw_data: GatewayData = {}
251
252
  self.gw_devices: dict[str, DeviceData] = {}
252
253
  self.loc_data: dict[str, ThermoLoc]
253
- self.smile_fw_version: str | None
254
+ self.smile_fw_version: Version | None
254
255
  self.smile_hw_version: str | None
255
256
  self.smile_mac_address: str | None
256
257
  self.smile_model: str
@@ -425,7 +426,7 @@ class SmileHelper(SmileCommon):
425
426
  def _appl_gateway_info(self, appl: Munch, appliance: etree) -> Munch:
426
427
  """Helper-function for _appliance_info_finder()."""
427
428
  self.gateway_id = appliance.attrib["id"]
428
- appl.firmware = self.smile_fw_version
429
+ appl.firmware = str(self.smile_fw_version)
429
430
  appl.hardware = self.smile_hw_version
430
431
  appl.mac = self.smile_mac_address
431
432
  appl.model = self.smile_model
@@ -44,6 +44,7 @@ from plugwise.util import (
44
44
  # This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts)
45
45
  from defusedxml import ElementTree as etree
46
46
  from munch import Munch
47
+ from packaging.version import Version
47
48
 
48
49
 
49
50
  def etree_to_dict(element: etree) -> dict[str, str]:
@@ -81,7 +82,7 @@ class SmileLegacyHelper(SmileCommon):
81
82
  self.gw_data: GatewayData = {}
82
83
  self.gw_devices: dict[str, DeviceData] = {}
83
84
  self.loc_data: dict[str, ThermoLoc]
84
- self.smile_fw_version: str | None
85
+ self.smile_fw_version: Version | None
85
86
  self.smile_hw_version: str | None
86
87
  self.smile_mac_address: str | None
87
88
  self.smile_model: str
@@ -194,7 +195,7 @@ class SmileLegacyHelper(SmileCommon):
194
195
  self.gw_devices[self.gateway_id] = {"dev_class": "gateway"}
195
196
  self._count += 1
196
197
  for key, value in {
197
- "firmware": self.smile_fw_version,
198
+ "firmware": str(self.smile_fw_version),
198
199
  "location": self._home_location,
199
200
  "mac_address": self.smile_mac_address,
200
201
  "model": self.smile_model,
@@ -29,6 +29,7 @@ from plugwise.legacy.data import SmileLegacyData
29
29
 
30
30
  import aiohttp
31
31
  from munch import Munch
32
+ from packaging.version import Version
32
33
 
33
34
 
34
35
  class SmileLegacyAPI(SmileLegacyData):
@@ -48,7 +49,7 @@ class SmileLegacyAPI(SmileLegacyData):
48
49
  _stretch_v2: bool,
49
50
  _target_smile: str,
50
51
  loc_data: dict[str, ThermoLoc],
51
- smile_fw_version: str | None,
52
+ smile_fw_version: Version | None,
52
53
  smile_hostname: str,
53
54
  smile_hw_version: str | None,
54
55
  smile_mac_address: str | None,
@@ -35,6 +35,7 @@ from defusedxml import ElementTree as etree
35
35
 
36
36
  # Dict as class
37
37
  from munch import Munch
38
+ from packaging.version import Version
38
39
 
39
40
 
40
41
  class SmileAPI(SmileData):
@@ -57,7 +58,7 @@ class SmileAPI(SmileData):
57
58
  _schedule_old_states: dict[str, dict[str, str]],
58
59
  gateway_id: str,
59
60
  loc_data: dict[str, ThermoLoc],
60
- smile_fw_version: str | None,
61
+ smile_fw_version: Version | None,
61
62
  smile_hostname: str | None,
62
63
  smile_hw_version: str | None,
63
64
  smile_mac_address: str | None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plugwise
3
- Version: 1.4.3
3
+ Version: 1.4.4
4
4
  Summary: Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3.
5
5
  Home-page: https://github.com/plugwise/python-plugwise
6
6
  Author: Plugwise device owners
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "plugwise"
7
- version = "1.4.3"
7
+ version = "1.4.4"
8
8
  license = {file = "LICENSE"}
9
9
  description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
10
10
  readme = "README.md"
@@ -17,6 +17,7 @@ import pytest
17
17
  # Testing
18
18
  import aiohttp
19
19
  from freezegun import freeze_time
20
+ from packaging import version
20
21
 
21
22
  pw_constants = importlib.import_module("plugwise.constants")
22
23
  pw_exceptions = importlib.import_module("plugwise.exceptions")
@@ -344,15 +345,17 @@ class TestPlugwise: # pylint: disable=attribute-defined-outside-init
344
345
  assert smile._timeout == 10
345
346
 
346
347
  # Connect to the smile
348
+ version = None
347
349
  try:
348
- connection_state = await smile.connect()
349
- assert connection_state
350
+ version = await smile.connect()
351
+ assert version is not None
350
352
  return server, smile, client
351
353
  except (
352
354
  pw_exceptions.ConnectionFailedError,
353
355
  pw_exceptions.InvalidXMLError,
354
356
  pw_exceptions.InvalidAuthentication,
355
357
  ) as exception:
358
+ assert version is None
356
359
  await self.disconnect(server, client)
357
360
  raise exception
358
361
 
@@ -427,15 +430,17 @@ class TestPlugwise: # pylint: disable=attribute-defined-outside-init
427
430
  assert smile._timeout == 30
428
431
 
429
432
  # Connect to the smile
433
+ version = None
430
434
  try:
431
- connection_state = await smile.connect()
432
- assert connection_state
435
+ version = await smile.connect()
436
+ assert version is not None
433
437
  return server, smile, client
434
438
  except (
435
439
  pw_exceptions.ConnectionFailedError,
436
440
  pw_exceptions.InvalidXMLError,
437
441
  pw_exceptions.InvalidAuthentication,
438
442
  ) as exception:
443
+ assert version is None
439
444
  await self.disconnect(server, client)
440
445
  raise exception
441
446
 
@@ -1004,7 +1009,7 @@ class TestPlugwise: # pylint: disable=attribute-defined-outside-init
1004
1009
  if smile_version:
1005
1010
  log_msg = f" # Assert version matching '{smile_version}"
1006
1011
  parent_logger.info(log_msg)
1007
- assert smile.smile_version == smile_version
1012
+ assert smile.smile_version == version.parse(smile_version)
1008
1013
  log_msg = f" # Assert legacy {smile_legacy}"
1009
1014
  parent_logger.info(log_msg)
1010
1015
  if smile_legacy:
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