Skip to content

Commit

Permalink
use a try/except to protect the binascii.unhexlify()
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Nov 1, 2023
1 parent 7b4efd8 commit 4d8198b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions DevicesModules/custom_zlinky.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,14 @@ def zlinky_cluster_lixee_private(self, Devices, nwkid, ep, cluster, attribut, va
elif attribut == "0217":
# Standard : STGE
self.log.logging( "ZLinky", "Log", "STGE raw Value: %s" % ( value ))
stge = binascii.unhexlify( value ).decode("utf-8")
self.log.logging( "ZLinky", "Log", "STGE unhexlify Value: %s" % ( stge ))
self.log.logging( "ZLinky", "Log", "STGE decoded : %s" % ( decode_STEG( stge ) ))
try:
stge = binascii.unhexlify( value ).decode("utf-8")
self.log.logging( "ZLinky", "Log", "STGE unhexlify Value: %s/%s" % ( value, stge ))
except Exception as e:
self.log.logging( "ZLinky", "Log", "STGE Value: %s" % ( value ))
stge = value

self.log.logging( "ZLinky", "Log", "STGE decoded %s : %s" % ( stge, decode_STEG( stge ) ))
store_ZLinky_infos( self, nwkid, "STGE", decode_STEG( stge ))
checkAndStoreAttributeValue(self, nwkid, ep, cluster, attribut, stge)

Expand Down Expand Up @@ -661,5 +666,4 @@ def zlinky_cluster_lixee_private(self, Devices, nwkid, ep, cluster, attribut, va

elif attribut == "0300":
# Linky Mode
update_zlinky_device_model_if_needed( self, nwkid )

update_zlinky_device_model_if_needed( self, nwkid )

0 comments on commit 4d8198b

Please sign in to comment.