Skip to content

Commit

Permalink
Merge pull request ngardiner#550 from RichieB2B/log-error
Browse files Browse the repository at this point in the history
Log slave error codes
  • Loading branch information
ngardiner authored Mar 5, 2024
2 parents 7cb086a + 5b9b8d8 commit 946c746
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/TWCManager/TWCSlave.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ def send_master_heartbeat(self):
# Manual says this code means 'The networked Wall
# Connectors have different maximum current
# capabilities.'
# 0000 1000 = No effect
# 0001 0000 = No effect
# 0010 0000 = No effect
# 0100 0000 = No effect
# 0000 1000 = No effect
# 0001 0000 = No effect
# 0010 0000 = No effect
# 0100 0000 = No effect
# 1000 0000 = No effect
# When two bits are set, the lowest bit (rightmost bit) seems to
# take precedence (ie 111 results in 3 blinks, 110 results in 5
Expand Down Expand Up @@ -577,6 +577,16 @@ def receive_slave_heartbeat(self, heartbeatData):
self.reportedAmpsActual = ((heartbeatData[3] << 8) + heartbeatData[4]) / 100
self.reportedState = heartbeatData[0]

if self.reportedState == 0x02:
logger.info(
"WARNING: slave TWC %02X%02X is sending error with status data: %s"
% (
self.TWCID[0],
self.TWCID[1],
self.master.hex_str(heartbeatData),
)
)

if self.reportedAmpsActual != self.reportedAmpsLast:
self.reportedAmpsLast = self.reportedAmpsActual
for module in self.master.getModulesByType("Status"):
Expand Down

0 comments on commit 946c746

Please sign in to comment.