pypck 0.8.1__tar.gz → 0.8.2__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.
- {pypck-0.8.1/pypck.egg-info → pypck-0.8.2}/PKG-INFO +1 -1
- pypck-0.8.2/VERSION +1 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/module.py +8 -3
- {pypck-0.8.1 → pypck-0.8.2}/pypck/pck_commands.py +14 -1
- {pypck-0.8.1 → pypck-0.8.2/pypck.egg-info}/PKG-INFO +1 -1
- {pypck-0.8.1 → pypck-0.8.2}/tests/test_commands.py +21 -2
- pypck-0.8.1/VERSION +0 -1
- {pypck-0.8.1 → pypck-0.8.2}/LICENSE +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/README.md +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/__init__.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/connection.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/helpers.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/inputs.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/lcn_addr.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/lcn_defs.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/request_handlers.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck/timeout_retry.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck.egg-info/SOURCES.txt +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck.egg-info/dependency_links.txt +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck.egg-info/not-zip-safe +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pypck.egg-info/top_level.txt +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/pyproject.toml +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/setup.cfg +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/tests/test_connection.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/tests/test_dyn_text.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/tests/test_messages.py +0 -0
- {pypck-0.8.1 → pypck-0.8.2}/tests/test_vars.py +0 -0
pypck-0.8.2/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.8.2
|
|
@@ -468,18 +468,23 @@ class AbstractConnection:
|
|
|
468
468
|
PckGenerator.var_rel(var, value_ref, value.to_native(), software_serial),
|
|
469
469
|
)
|
|
470
470
|
|
|
471
|
-
async def lock_regulator(
|
|
471
|
+
async def lock_regulator(
|
|
472
|
+
self, reg_id: int, state: bool, target_value: float = -1
|
|
473
|
+
) -> bool:
|
|
472
474
|
"""Send a command to lock a regulator.
|
|
473
475
|
|
|
474
476
|
:param int reg_id: Regulator id
|
|
475
477
|
:param bool state: Lock state (locked=True,
|
|
476
478
|
unlocked=False)
|
|
477
|
-
|
|
479
|
+
:param float target_value: Target value in percent (use -1 to ignore)
|
|
478
480
|
:returns: True if command was sent successfully, False otherwise
|
|
479
481
|
:rtype: bool
|
|
480
482
|
"""
|
|
481
483
|
return await self.send_command(
|
|
482
|
-
self.wants_ack,
|
|
484
|
+
self.wants_ack,
|
|
485
|
+
PckGenerator.lock_regulator(
|
|
486
|
+
reg_id, state, self.software_serial, target_value
|
|
487
|
+
),
|
|
483
488
|
)
|
|
484
489
|
|
|
485
490
|
async def control_led(
|
|
@@ -1029,16 +1029,29 @@ class PckGenerator:
|
|
|
1029
1029
|
return f"GTDT{row_id + 1}{part_id + 1}".encode() + part
|
|
1030
1030
|
|
|
1031
1031
|
@staticmethod
|
|
1032
|
-
def lock_regulator(
|
|
1032
|
+
def lock_regulator(
|
|
1033
|
+
reg_id: int,
|
|
1034
|
+
state: bool,
|
|
1035
|
+
software_serial: int,
|
|
1036
|
+
target_value: float = -1,
|
|
1037
|
+
) -> str:
|
|
1033
1038
|
"""Generate a command to lock a regulator.
|
|
1034
1039
|
|
|
1035
1040
|
:param int reg_id: Regulator id 0..1
|
|
1036
1041
|
:param bool state: The lock state
|
|
1042
|
+
:param int software_serial: The expected firmware version of all
|
|
1043
|
+
receiving modules.
|
|
1044
|
+
:param foat target_value: The target value in percent (use -1 to ignore)
|
|
1037
1045
|
:return: The PCK command (without address header) as text
|
|
1038
1046
|
:rtype: str
|
|
1039
1047
|
"""
|
|
1040
1048
|
if (reg_id < 0) or (reg_id > 1):
|
|
1041
1049
|
raise ValueError("Wrong reg_id.")
|
|
1050
|
+
if ((target_value < 0) or (target_value > 100)) and (target_value != -1):
|
|
1051
|
+
raise ValueError("Wrong target_value.")
|
|
1052
|
+
if (target_value != -1) and (software_serial >= 0x120301) and state:
|
|
1053
|
+
reg_byte = reg_id * 0x40 + 0x07
|
|
1054
|
+
return f"X2{0x1E:03d}{reg_byte:03d}{int(2*target_value):03d}"
|
|
1042
1055
|
return f"RE{'A' if reg_id == 0 else 'B'}X{'S' if state else 'A'}"
|
|
1043
1056
|
|
|
1044
1057
|
@staticmethod
|
|
@@ -417,11 +417,30 @@ COMMANDS = {
|
|
|
417
417
|
},
|
|
418
418
|
# Lock regulator
|
|
419
419
|
**{
|
|
420
|
-
f"RE{('A','B')[reg]:s}XS": (PckGenerator.lock_regulator, reg, True)
|
|
420
|
+
f"RE{('A','B')[reg]:s}XS": (PckGenerator.lock_regulator, reg, True, -1)
|
|
421
421
|
for reg in range(2)
|
|
422
422
|
},
|
|
423
423
|
**{
|
|
424
|
-
f"RE{('A','B')[reg]:s}XA": (PckGenerator.lock_regulator, reg, False)
|
|
424
|
+
f"RE{('A','B')[reg]:s}XA": (PckGenerator.lock_regulator, reg, False, -1)
|
|
425
|
+
for reg in range(2)
|
|
426
|
+
},
|
|
427
|
+
**{
|
|
428
|
+
f"X2030{0x40*reg + 0x07:03d}{2*value:03d}": (
|
|
429
|
+
PckGenerator.lock_regulator,
|
|
430
|
+
reg,
|
|
431
|
+
True,
|
|
432
|
+
0x120301,
|
|
433
|
+
value,
|
|
434
|
+
)
|
|
435
|
+
for reg in range(2)
|
|
436
|
+
for value in (0, 50, 100)
|
|
437
|
+
},
|
|
438
|
+
**{
|
|
439
|
+
f"RE{('A','B')[reg]:s}XS": (PckGenerator.lock_regulator, reg, True, 0x120301)
|
|
440
|
+
for reg in range(2)
|
|
441
|
+
},
|
|
442
|
+
**{
|
|
443
|
+
f"RE{('A','B')[reg]:s}XA": (PckGenerator.lock_regulator, reg, False, 0x120301)
|
|
425
444
|
for reg in range(2)
|
|
426
445
|
},
|
|
427
446
|
# scenes
|
pypck-0.8.1/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.8.1
|
|
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
|