Skip to content

Commit

Permalink
Do not rate limit status messages in receive_slave_heartbeat(), fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieB2B committed Jun 2, 2023
1 parent 93a5606 commit 7311e4f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/TWCManager/TWCSlave.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class TWCSlave:
reportedAmpsMax = 0
reportedAmpsActual = 0
reportedState = 0
reportedAmpsLast = -1

# history* vars are used to track power usage over time
historyAvgAmps = 0
Expand Down Expand Up @@ -577,19 +576,16 @@ def receive_slave_heartbeat(self, heartbeatData):
self.reportedAmpsActual = ((heartbeatData[3] << 8) + heartbeatData[4]) / 100
self.reportedState = heartbeatData[0]

if self.reportedAmpsActual != self.reportedAmpsLast:
self.reportedAmpsLast = self.reportedAmpsActual
for module in self.master.getModulesByType("Status"):
module["ref"].setStatus(
self.TWCID, "amps_in_use", "ampsInUse", self.reportedAmpsActual, "A"
)
self.refreshingChargerLoadStatus()
self.master.refreshingTotalAmpsInUseStatus()
self.refreshingChargerLoadStatus()
self.master.refreshingTotalAmpsInUseStatus()

for module in self.master.getModulesByType("Status"):
module["ref"].setStatus(
self.TWCID, "amps_max", "ampsMax", self.reportedAmpsMax, "A"
)
module["ref"].setStatus(
self.TWCID, "amps_in_use", "ampsInUse", self.reportedAmpsActual, "A"
)
module["ref"].setStatus(
self.TWCID, "state", "state", self.reportedState, ""
)
Expand Down

0 comments on commit 7311e4f

Please sign in to comment.