pypck 0.9.6__py3-none-any.whl → 0.9.7__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/device.py +32 -11
- {pypck-0.9.6.dist-info → pypck-0.9.7.dist-info}/METADATA +1 -1
- {pypck-0.9.6.dist-info → pypck-0.9.7.dist-info}/RECORD +6 -6
- {pypck-0.9.6.dist-info → pypck-0.9.7.dist-info}/WHEEL +0 -0
- {pypck-0.9.6.dist-info → pypck-0.9.7.dist-info}/licenses/LICENSE +0 -0
- {pypck-0.9.6.dist-info → pypck-0.9.7.dist-info}/top_level.txt +0 -0
pypck/device.py
CHANGED
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
pypck/__init__.py,sha256=jVx-aBsV_LmBf6jiivMrMcBUofC_AOseywDafgOzAS4,323
|
|
2
2
|
pypck/connection.py,sha256=n3itRe8oQtw64vyWGYhl6j4QJC6wgeeHitBSn-Cl2_4,23330
|
|
3
|
-
pypck/device.py,sha256=
|
|
3
|
+
pypck/device.py,sha256=Ek-Zy4Id63vl43oW1pSafbDqRAfidhgoJI0F4EMWCXY,40375
|
|
4
4
|
pypck/helpers.py,sha256=_5doqIsSRpqdQNPIUsjFh813xKGuMuEFY6sNGobJGIk,1280
|
|
5
5
|
pypck/inputs.py,sha256=F7E8rprIhYzZnHARozt_hguYNgJaiNP3htrZ2E3Qa5I,45951
|
|
6
6
|
pypck/lcn_addr.py,sha256=N2Od8KuANOglqKjf596hJVH1SRcG7MhESKA5YYlDnbw,1946
|
|
@@ -8,8 +8,8 @@ pypck/lcn_defs.py,sha256=wSceYBwM46NqPwvff1hi8RluqUECmNY1gNcm1kDKTaI,43356
|
|
|
8
8
|
pypck/pck_commands.py,sha256=eJxmh2e8EbKGpek97L2961Kr_nVfT8rKgJCN3YgjIQM,50458
|
|
9
9
|
pypck/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
pypck/status_requester.py,sha256=10N5pbIBe_Ao-9ui_D7mCavk21BYZs9c-kxcTtmi-FI,5721
|
|
11
|
-
pypck-0.9.
|
|
12
|
-
pypck-0.9.
|
|
13
|
-
pypck-0.9.
|
|
14
|
-
pypck-0.9.
|
|
15
|
-
pypck-0.9.
|
|
11
|
+
pypck-0.9.7.dist-info/licenses/LICENSE,sha256=iYB6zyMJvShfAzQE7nhYFgLzzZuBmhasLw5fYP9KRz4,1023
|
|
12
|
+
pypck-0.9.7.dist-info/METADATA,sha256=gooJ1CbK2mtAKuIEs8v3OKV_sDMHziMbmKHGPcEvsmE,2682
|
|
13
|
+
pypck-0.9.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
pypck-0.9.7.dist-info/top_level.txt,sha256=59ried49iFueDa5mQ_5BGVZcESjjzi4MZZKLcganvQA,6
|
|
15
|
+
pypck-0.9.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|