Skip to content

Commit

Permalink
FIX: querying inactive relay in update_ui() (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail authored Nov 25, 2024
1 parent 9ddbdf6 commit 9039563
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions octoprint_octorelay/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,13 @@ def update_ui(self):
))
for index in RELAY_INDEXES:
active = bool(settings[index]["active"])
relay = Driver.ensure(
int(settings[index]["relay_pin"] or 0),
bool(settings[index]["inverted_output"])
)
relay_state = relay.is_closed() if active else False
pin = int(settings[index]["relay_pin"] or 0)
inverted = bool(settings[index]["inverted_output"])
relay_state = Driver.ensure(pin, inverted).is_closed() if active else False
task = upcoming_tasks[index]
self.model[index] = {
"relay_pin": relay.pin,
"inverted_output": relay.inverted,
"relay_pin": pin,
"inverted_output": inverted,
"relay_state": relay_state, # bool since v3.1
"label_text": settings[index]["label_text"],
"active": active,
Expand Down

0 comments on commit 9039563

Please sign in to comment.