Check status field for UPS online binary sensor (#30144)
Avoids issue where status was previously reported as offline when battery was low or UPS was over voltage
This commit is contained in:
1 parent
6b519499a7
commit
8a1fc8b8f0
2 files changed
+4
-4
No files matched your search
@@ -34,8 +34,8 @@ class OnlineStatus(BinarySensorDevice):
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if the UPS is online, else false."""
|
||||
return self._state == apcupsd.VALUE_ONLINE
|
||||
return self._state & apcupsd.VALUE_ONLINE > 0
|
||||
|
||||
def update(self):
|
||||
"""Get the status report from APCUPSd and set this entity's state."""
|
||||
self._state = self._data.status[apcupsd.KEY_STATUS]
|
||||
self._state = int(self._data.status[apcupsd.KEY_STATUS], 16)
|
||||
Reference in new issue
Block a user