power: Don't query a gpio line in "refresh_status"

On some devices gpiod does not report the correct state.  Since Moonraker maintains exclusive control over GPIO lines, its unnecessary to query the line itself for state, as we can maintain it ourselves.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-05-17 16:53:28 -04:00
parent fd07b077b9
commit 9fe6ef82a5
1 changed files with 1 additions and 8 deletions

View File

@ -352,14 +352,7 @@ class GpioDevice(PowerDevice):
self.set_power("on" if self.initial_state else "off")
def refresh_status(self):
try:
val = self.line.get_value()
except Exception:
self.state = "error"
msg = f"Error Refeshing Device Status: {self.name}"
logging.exception(msg)
raise self.server.error(msg) from None
self.state = "on" if val else "off"
pass
def set_power(self, state):
try: