pypck 0.9.6__tar.gz → 0.9.7__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.9.6/pypck.egg-info → pypck-0.9.7}/PKG-INFO +1 -1
- pypck-0.9.7/VERSION +1 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/device.py +32 -11
- {pypck-0.9.6 → pypck-0.9.7/pypck.egg-info}/PKG-INFO +1 -1
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_module.py +5 -10
- pypck-0.9.6/VERSION +0 -1
- {pypck-0.9.6 → pypck-0.9.7}/LICENSE +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/README.md +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/__init__.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/connection.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/helpers.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/inputs.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/lcn_addr.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/lcn_defs.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/pck_commands.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/py.typed +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck/status_requester.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck.egg-info/SOURCES.txt +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck.egg-info/dependency_links.txt +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck.egg-info/not-zip-safe +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pypck.egg-info/top_level.txt +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/pyproject.toml +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/setup.cfg +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_commands.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_connection.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_dyn_text.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_input.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_messages.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_status_requester.py +0 -0
- {pypck-0.9.6 → pypck-0.9.7}/tests/test_vars.py +0 -0
pypck-0.9.7/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.9.7
|
|
@@ -50,6 +50,8 @@ class DeviceConnection:
|
|
|
50
50
|
self._serials_known = asyncio.Event()
|
|
51
51
|
|
|
52
52
|
self.input_callbacks: set[Callable[[inputs.Input], None]] = set()
|
|
53
|
+
self.last_requested_var_without_type_in_response = lcn_defs.Var.UNKNOWN
|
|
54
|
+
self.last_var_lock = asyncio.Lock()
|
|
53
55
|
|
|
54
56
|
# List of queued acknowledge codes from the LCN modules.
|
|
55
57
|
self.acknowledges: asyncio.Queue[lcn_defs.AcknowledgeErrorCode] = (
|
|
@@ -771,9 +773,29 @@ class DeviceConnection:
|
|
|
771
773
|
await self.on_ack(inp.code)
|
|
772
774
|
return None
|
|
773
775
|
|
|
776
|
+
# handle typeless variable responses
|
|
777
|
+
if isinstance(inp, inputs.ModStatusVar):
|
|
778
|
+
inp = self.preprocess_modstatusvar(inp)
|
|
779
|
+
|
|
774
780
|
for input_callback in self.input_callbacks:
|
|
775
781
|
input_callback(inp)
|
|
776
782
|
|
|
783
|
+
def preprocess_modstatusvar(self, inp: inputs.ModStatusVar) -> inputs.Input:
|
|
784
|
+
"""Fill typeless response with last requested variable type."""
|
|
785
|
+
if inp.orig_var == lcn_defs.Var.UNKNOWN:
|
|
786
|
+
# Response without type (%Msssaaa.wwwww)
|
|
787
|
+
inp.var = self.last_requested_var_without_type_in_response
|
|
788
|
+
|
|
789
|
+
self.last_requested_var_without_type_in_response = lcn_defs.Var.UNKNOWN
|
|
790
|
+
|
|
791
|
+
if self.last_var_lock.locked():
|
|
792
|
+
self.last_var_lock.release()
|
|
793
|
+
else:
|
|
794
|
+
# Response with variable type (%Msssaaa.Avvvwww)
|
|
795
|
+
inp.var = inp.orig_var
|
|
796
|
+
|
|
797
|
+
return inp
|
|
798
|
+
|
|
777
799
|
async def dump_details(self) -> dict[str, Any]:
|
|
778
800
|
"""Dump detailed information about this module."""
|
|
779
801
|
is_local_segment = self.addr.seg_id in (0, self.conn.local_seg_id)
|
|
@@ -910,10 +932,14 @@ class DeviceConnection:
|
|
|
910
932
|
# do not use buffered response for old modules
|
|
911
933
|
# (variable response is typeless)
|
|
912
934
|
if self.serials.software_serial < 0x170206:
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
935
|
+
if not lcn_defs.Var.has_type_in_response(
|
|
936
|
+
variable, self.serials.software_serial
|
|
937
|
+
):
|
|
938
|
+
try:
|
|
939
|
+
await asyncio.wait_for(self.last_var_lock.acquire(), timeout=3.0)
|
|
940
|
+
except asyncio.TimeoutError:
|
|
941
|
+
pass
|
|
942
|
+
self.last_requested_var_without_type_in_response = variable
|
|
917
943
|
|
|
918
944
|
result = await self.status_requester.request(
|
|
919
945
|
response_type=inputs.ModStatusVar,
|
|
@@ -921,15 +947,10 @@ class DeviceConnection:
|
|
|
921
947
|
variable, self.serials.software_serial
|
|
922
948
|
),
|
|
923
949
|
max_age=max_age,
|
|
924
|
-
var=
|
|
950
|
+
var=variable,
|
|
925
951
|
)
|
|
926
952
|
|
|
927
|
-
|
|
928
|
-
if result:
|
|
929
|
-
if result.orig_var == lcn_defs.Var.UNKNOWN:
|
|
930
|
-
# Response without type (%Msssaaa.wwwww)
|
|
931
|
-
result.var = variable
|
|
932
|
-
return result
|
|
953
|
+
return cast(inputs.ModStatusVar, result)
|
|
933
954
|
|
|
934
955
|
async def request_status_led_and_logic_ops(
|
|
935
956
|
self, max_age: int = 0
|
|
@@ -140,17 +140,17 @@ async def test_request_status_binary_sensors(module10: MockDeviceConnection) ->
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
@pytest.mark.parametrize(
|
|
143
|
-
"variable,
|
|
143
|
+
"variable, software_serial",
|
|
144
144
|
[
|
|
145
145
|
*[
|
|
146
|
-
(variable,
|
|
146
|
+
(variable, 0x170206)
|
|
147
147
|
for variable in lcn_defs.Var.variables_new()
|
|
148
148
|
+ lcn_defs.Var.set_points()
|
|
149
149
|
+ list(chain(*lcn_defs.Var.thresholds_new()))
|
|
150
150
|
+ lcn_defs.Var.s0s()
|
|
151
151
|
],
|
|
152
152
|
*[
|
|
153
|
-
(variable,
|
|
153
|
+
(variable, 0x170000)
|
|
154
154
|
for variable in lcn_defs.Var.variables_old()
|
|
155
155
|
+ lcn_defs.Var.set_points()
|
|
156
156
|
+ list(chain(*lcn_defs.Var.thresholds_old()))
|
|
@@ -158,10 +158,7 @@ async def test_request_status_binary_sensors(module10: MockDeviceConnection) ->
|
|
|
158
158
|
],
|
|
159
159
|
)
|
|
160
160
|
async def test_request_status_variable(
|
|
161
|
-
module10: MockDeviceConnection,
|
|
162
|
-
variable: lcn_defs.Var,
|
|
163
|
-
response_variable: lcn_defs.Var,
|
|
164
|
-
software_serial: int,
|
|
161
|
+
module10: MockDeviceConnection, variable: lcn_defs.Var, software_serial: int
|
|
165
162
|
) -> None:
|
|
166
163
|
"""Test requesting the variable status of a module."""
|
|
167
164
|
module10.serials.software_serial = software_serial
|
|
@@ -169,9 +166,7 @@ async def test_request_status_variable(
|
|
|
169
166
|
|
|
170
167
|
await wait_until_called(module10.send_command)
|
|
171
168
|
await module10.async_process_input(
|
|
172
|
-
inputs.ModStatusVar(
|
|
173
|
-
module10.addr, response_variable, lcn_defs.VarValue.from_native(50)
|
|
174
|
-
)
|
|
169
|
+
inputs.ModStatusVar(module10.addr, variable, lcn_defs.VarValue.from_native(50))
|
|
175
170
|
)
|
|
176
171
|
|
|
177
172
|
result = await request_task
|
pypck-0.9.6/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.9.6
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|