Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def unserialize(self, response):
PlugwiseAckResponse.unserialize(self, response)
self.mac = str(self.acqmac.value)
def unserialize(self, response):
try:
PlugwiseResponse.unserialize(self, response)
except UnexpectedResponse as reason:
if self.function_code != None and self.function_code in ['0006', '0061']:
raise
elif self.expected_command_counter is None:
#In case of awaiting an Ack without knowing a seqnr, the most likely reason of
#an UnexpectedResponse is a duplicate (ghost) response from an older SEND request.
raise OutOfSequenceException("expected command ack from stick. received message with seqnr %s - this may be a duplicate message" % (self.command_counter,))
else:
raise
class PlugwiseAckMacResponse(PlugwiseAckResponse):
ID = b'0000'
def __init__(self, seqnr = None):
PlugwiseAckResponse.__init__(self, seqnr)
self.acqmac = String(None, length=16)
self.params += [self.acqmac]
def unserialize(self, response):
PlugwiseAckResponse.unserialize(self, response)
self.mac = str(self.acqmac.value)
class PlugwiseCalibrationResponse(PlugwiseResponse):
ID = b'0027'
def __init__(self, seqnr = None):
PlugwiseResponse.__init__(self, seqnr)
def __init__(self, seqnr = None):
PlugwiseAckResponse.__init__(self, seqnr)
self.acqmac = String(None, length=16)
self.params += [self.acqmac]