Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,19 @@ def getStatus(self):
return False

# Assign the values to their respective variables
self.gACT = (status[0] >> 0) & 0x01
self.gGTO = (status[0] >> 3) & 0x01
self.gSTA = (status[0] >> 4) & 0x03
self.gOBJ = (status[0] >> 6) & 0x03
self.gFLT = status[2]
self.gPR = status[3]
self.gPO = status[4]
self.gCU = status[5]
if status[0] is not None:
self.gACT = (status[0] >> 0) & 0x01
self.gGTO = (status[0] >> 3) & 0x01
self.gSTA = (status[0] >> 4) & 0x03
self.gOBJ = (status[0] >> 6) & 0x03
if status[2] is not None:
self.gFLT = status[2]
if status[3] is not None:
self.gPR = status[3]
if status[4] is not None:
self.gPO = status[4]
if status[5] is not None:
self.gCU = status[5]

return True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def getStatus(self, numBytes):
# print("Failed to receive status")
return None
# Newer versions of pymodbus returns a ModbusIOException instead
elif type(response) is ModbusIOException:
elif isinstance(response, ModbusIOException):
return None

# Instantiate output as an empty list
Expand Down