Skip to content

Commit

Permalink
Decode0110: fix decoding loop
Browse files Browse the repository at this point in the history
The loop is using range(24, len(MsgData), 4) to generate iterator
value instead of relying the current index value.

Signed-off-by: Arnaud Patard <[email protected]>
  • Loading branch information
thertp committed Nov 20, 2023
1 parent dd3e7cf commit 6f27721
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Modules/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,16 @@ def Decode0110(self, Devices, MsgData, MsgLQI): # Write Attribute request
timeStamped(self, MsgSrcAddr, 0x0110)
lastSeenUpdate(self, Devices, NwkId=MsgSrcAddr)

for idx in range(24, len(MsgData), 4):
idx = 24
while idx < len(MsgData):
Attribute = MsgData[idx : idx + 4]
idx += 4
DataType = MsgData[idx : idx + 2]
idx += 2
lendata = MsgData[idx : idx + 4]
idx += 4
DataValue = MsgData[idx : idx + int(lendata,16) * 2]
idx += int(lendata, 16) * 2

self.log.logging( "Input", "Debug", "Decode0110 - Sqn: %s NwkId: %s Ep: %s Cluster: %s Manuf: %s Attribute: %s Type: %s Value: %s" % (
MsgSqn, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgManufCode, Attribute, DataType, DataValue), )
Expand Down

0 comments on commit 6f27721

Please sign in to comment.