pypck 0.8.3__py3-none-any.whl → 0.8.4__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.
pypck/connection.py CHANGED
@@ -164,12 +164,22 @@ class PchkConnectionManager:
164
164
  break
165
165
 
166
166
  try:
167
- message = data.decode().split(PckGenerator.TERMINATION)[0]
167
+ message = data.decode("utf-8").split(PckGenerator.TERMINATION)[0]
168
168
  except UnicodeDecodeError as err:
169
- _LOGGER.warning(
170
- "PCK decoding error: %s - skipping received PCK message", err
171
- )
172
- continue
169
+ try:
170
+ message = data.decode("cp1250").split(PckGenerator.TERMINATION)[
171
+ 0
172
+ ]
173
+ _LOGGER.warning(
174
+ "Incorrect PCK encoding detected, possibly caused by LinHK: %s - PCK recovered using cp1250",
175
+ err,
176
+ )
177
+ except UnicodeDecodeError as err2:
178
+ _LOGGER.warning(
179
+ "PCK decoding error: %s - skipping received PCK message",
180
+ err2,
181
+ )
182
+ continue
173
183
  await self.process_message(message)
174
184
  except asyncio.CancelledError:
175
185
  pass
pypck/inputs.py CHANGED
@@ -392,7 +392,17 @@ class ModSn(ModInput):
392
392
  if matcher:
393
393
  addr = LcnAddr(int(matcher.group("seg_id")), int(matcher.group("mod_id")))
394
394
  hardware_serial = int(matcher.group("hardware_serial"), 16)
395
- manu = int(matcher.group("manu"), 16)
395
+ try:
396
+ manu = int(matcher.group("manu"), 16)
397
+ except (
398
+ ValueError
399
+ ): # unconventional manufacturer code (e.g., due to LinHK VM)
400
+ manu = 0xFF
401
+ _LOGGER.debug(
402
+ "Unconventional manufacturer code: %s. Defaulting to 0x%02X",
403
+ matcher.group("manu"),
404
+ manu,
405
+ )
396
406
  software_serial = int(matcher.group("software_serial"), 16)
397
407
  try:
398
408
  hardware_type = lcn_defs.HardwareType(
pypck/pck_commands.py CHANGED
@@ -60,7 +60,7 @@ class PckParser:
60
60
  # Pattern to parse serial number and firmware date responses.
61
61
  PATTERN_SN = re.compile(
62
62
  r"=M(?P<seg_id>\d{3})(?P<mod_id>\d{3})\.SN(?P<hardware_serial>[0-9|A-F]{10})"
63
- r"(?P<manu>[0-9|A-F]{2})FW(?P<software_serial>[0-9|A-F]{6})"
63
+ r"(?P<manu>.{2})FW(?P<software_serial>[0-9|A-F]{6})"
64
64
  r"HW(?P<hardware_type>\d+)"
65
65
  )
66
66
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pypck
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: LCN-PCK library
5
5
  Home-page: https://github.com/alengwenus/pypck
6
6
  Author-email: Andre Lengwenus <alengwenus@gmail.com>
@@ -1,15 +1,15 @@
1
1
  pypck/__init__.py,sha256=vjI-MSv-ght8Y_tcKPXYMjL-FGlHX6Z2ofrUBrz8g4U,317
2
- pypck/connection.py,sha256=AamliVspTxlzHkVeWocexRRMhEZ70bt5rI083BqWpHw,23987
2
+ pypck/connection.py,sha256=lvhQE4ndFfvA5Ns5vszTqEQpzG0p9dPoM3Ss3J7ap3w,24487
3
3
  pypck/helpers.py,sha256=hEGId1pQ4wOJgIwNKDx17qKBlxvNxvspSrI0gSY3wCQ,1267
4
- pypck/inputs.py,sha256=QBpdGpHKa2iQdrXMai_mbO_MGRmPCk4BWiNb_ta8-DU,40227
4
+ pypck/inputs.py,sha256=EMz5FsWTBpftHdRBBJ7A-6gXHPTDBiH_S1xqvZCiMco,40599
5
5
  pypck/lcn_addr.py,sha256=N2Od8KuANOglqKjf596hJVH1SRcG7MhESKA5YYlDnbw,1946
6
6
  pypck/lcn_defs.py,sha256=sU0uGYyCLrnl-1aaHe5BtPE1kExESiPGmJFGdv9FWCk,40610
7
7
  pypck/module.py,sha256=o9SB-Gr2w6ZioJa0lpzOWW5IFtWsd1ojV3qgIVjJIxw,37314
8
- pypck/pck_commands.py,sha256=nR3LAdWbLD7yrtHfQigIIdMYPAIGM36A1fDAc2AD9Dk,46801
8
+ pypck/pck_commands.py,sha256=Rtui9w7TTD5IPiemHVaoaoyIMw0t_BEI3RHm-SP_f0E,46793
9
9
  pypck/request_handlers.py,sha256=6TvaWonhWcwDhqoUIS96xIj1_1lcUte2VLDMxovgJAs,24164
10
10
  pypck/timeout_retry.py,sha256=5KiTDPzegym-6qi_mM4I8ChJbJjg9HXECFyAZt4c02w,3944
11
- pypck-0.8.3.dist-info/LICENSE,sha256=iYB6zyMJvShfAzQE7nhYFgLzzZuBmhasLw5fYP9KRz4,1023
12
- pypck-0.8.3.dist-info/METADATA,sha256=3N9V2hCU79mo8oegZwSoqBDHZJBaTs574XXXmi2VhrI,5581
13
- pypck-0.8.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
14
- pypck-0.8.3.dist-info/top_level.txt,sha256=59ried49iFueDa5mQ_5BGVZcESjjzi4MZZKLcganvQA,6
15
- pypck-0.8.3.dist-info/RECORD,,
11
+ pypck-0.8.4.dist-info/LICENSE,sha256=iYB6zyMJvShfAzQE7nhYFgLzzZuBmhasLw5fYP9KRz4,1023
12
+ pypck-0.8.4.dist-info/METADATA,sha256=eXmEViNAiNF3dGvbbNkPotdJcpA_efTy3ucqfjZiKrM,5581
13
+ pypck-0.8.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
14
+ pypck-0.8.4.dist-info/top_level.txt,sha256=59ried49iFueDa5mQ_5BGVZcESjjzi4MZZKLcganvQA,6
15
+ pypck-0.8.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
File without changes