From 682a4b1eac2c311b7deb559b113b427f9f51b1bb Mon Sep 17 00:00:00 2001 From: Patrick Pichon Date: Sun, 12 Jan 2025 17:27:01 +0100 Subject: [PATCH 1/3] Enable polling InletTempPolling inlet temperature --- Modules/heartbeat.py | 5 ++++- Modules/readAttributes.py | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Modules/heartbeat.py b/Modules/heartbeat.py index 065a3ef80..18a78534d 100755 --- a/Modules/heartbeat.py +++ b/Modules/heartbeat.py @@ -47,6 +47,7 @@ ReadAttributeRequest_0402, ReadAttributeRequest_0405, ReadAttributeRequest_0702_0000, + ReadAttributeRequest_0702_0017, ReadAttributeRequest_0702_PC321, ReadAttributeRequest_0702_ZLinky_TIC, ReadAttributeRequest_ff66, @@ -344,7 +345,9 @@ def pollingManufSpecificDevices(self, NwkId, HB): "HumiPollingFreq": ReadAttributeRequest_0405, "BattPollingFreq": ReadAttributeRequest_0001, "ZLinkyIndexes": ReadAttributeReq_Scheduled_ZLinky, # Based on a specific time - "ZLinkyPollingPTEC": ReadAttributeReq_Scheduled_ZLinky # Every 15' by default + "ZLinkyPollingPTEC": ReadAttributeReq_Scheduled_ZLinky, # Every 15' by default + "InletTempPolling": ReadAttributeRequest_0702_0017, # Retreive Inlet Temperature + } if "Param" not in self.ListOfDevices[NwkId]: diff --git a/Modules/readAttributes.py b/Modules/readAttributes.py index 9920351bb..0e40e3d2b 100644 --- a/Modules/readAttributes.py +++ b/Modules/readAttributes.py @@ -1333,6 +1333,16 @@ def ReadAttributeRequest_0702_0000(self, key): self.log.logging("ReadAttributes", "Debug", "Request Summation on 0x0702 cluster: " + key + " EPout = " + EPout, nwkid=key) ReadAttributeReq(self, key, ZIGATE_EP, EPout, "0702", listAttributes, ackIsDisabled=is_ack_tobe_disabled(self, key)) + +def ReadAttributeRequest_0702_0017(self, key): + # Cluster 0x0702 Metering / Specific 0x0017 (Device Temperature) + ListOfEp = getListOfEpForCluster(self, key, "0702") + for EPout in ListOfEp: + listAttributes = [0x0017] + self.log.logging("ReadAttributes", "Debug", "Request InletTemperature on 0x0702 cluster: " + key + " EPout = " + EPout, nwkid=key) + ReadAttributeReq(self, key, ZIGATE_EP, EPout, "0702", listAttributes, ackIsDisabled=is_ack_tobe_disabled(self, key)) + + def ReadAttributeRequest_0702_multiplier_divisor(self, key): ListOfEp = getListOfEpForCluster(self, key, "0702") for EPout in ListOfEp: From 55cffb931349e5108563a08826e16010e30440d4 Mon Sep 17 00:00:00 2001 From: Patrick Pichon Date: Sun, 12 Jan 2025 18:03:50 +0100 Subject: [PATCH 2/3] prevent readAttribute on FakeEp --- Modules/tools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/tools.py b/Modules/tools.py index aea21b899..4ced7cdde 100644 --- a/Modules/tools.py +++ b/Modules/tools.py @@ -108,6 +108,10 @@ def getListOfEpForCluster(self, NwkId, SearchCluster): oldFashion = ( "ClusterType" in self.ListOfDevices[NwkId] and self.ListOfDevices[NwkId]["ClusterType"] not in ({}, "") ) for Ep in list(self.ListOfDevices[NwkId]["Ep"].keys()): + # check that is not a Fake Ep + if is_fake_ep(self, NwkId, Ep): + continue + if SearchCluster not in self.ListOfDevices[NwkId]["Ep"][Ep]: continue From 3071e6e2159fe23ba6bcd77ef9235170fe4fdd6e Mon Sep 17 00:00:00 2001 From: Patrick Pichon Date: Tue, 14 Jan 2025 16:15:56 +0100 Subject: [PATCH 3/3] refactor ReadAttributeRequest_0702_0017() --- Modules/readAttributes.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Modules/readAttributes.py b/Modules/readAttributes.py index 0e40e3d2b..f41045bcf 100644 --- a/Modules/readAttributes.py +++ b/Modules/readAttributes.py @@ -1335,12 +1335,30 @@ def ReadAttributeRequest_0702_0000(self, key): def ReadAttributeRequest_0702_0017(self, key): - # Cluster 0x0702 Metering / Specific 0x0017 (Device Temperature) - ListOfEp = getListOfEpForCluster(self, key, "0702") - for EPout in ListOfEp: - listAttributes = [0x0017] - self.log.logging("ReadAttributes", "Debug", "Request InletTemperature on 0x0702 cluster: " + key + " EPout = " + EPout, nwkid=key) - ReadAttributeReq(self, key, ZIGATE_EP, EPout, "0702", listAttributes, ackIsDisabled=is_ack_tobe_disabled(self, key)) + """ + Reads the InletTemperature (Attribute 0x0017) from the Metering cluster (0x0702). + + Parameters: + self: The instance of the class. + key: The network identifier for the device. + """ + + # Define the cluster and attribute + cluster_id = "0702" + listAttributes = [0x0017] + + # Get the list of endpoints for the cluster + endpoints = getListOfEpForCluster(self, key, cluster_id) + for endpoint in endpoints: + self.log.logging( + "ReadAttributes", + "Debug", + f"Requesting InletTemperature (Attribute {listAttributes}) on cluster {cluster_id} for key {key}, EP = {endpoint}.", + nwkid=key + ) + + # Send the read attribute request + ReadAttributeReq(self, key, ZIGATE_EP, endpoint, cluster_id, listAttributes, ackIsDisabled=is_ack_tobe_disabled(self, key)) def ReadAttributeRequest_0702_multiplier_divisor(self, key):