diff --git a/homeassistant/components/apcupsd/__init__.py b/homeassistant/components/apcupsd/__init__.py index 71f25f04387..01f74165190 100644 --- a/homeassistant/components/apcupsd/__init__.py +++ b/homeassistant/components/apcupsd/__init__.py @@ -18,11 +18,11 @@ DEFAULT_HOST = "localhost" DEFAULT_PORT = 3551 DOMAIN = "apcupsd" -KEY_STATUS = "STATUS" +KEY_STATUS = "STATFLAG" MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60) -VALUE_ONLINE = "ONLINE" +VALUE_ONLINE = 8 CONFIG_SCHEMA = vol.Schema( { diff --git a/homeassistant/components/apcupsd/binary_sensor.py b/homeassistant/components/apcupsd/binary_sensor.py index 29825fd695e..de4e1f17200 100644 --- a/homeassistant/components/apcupsd/binary_sensor.py +++ b/homeassistant/components/apcupsd/binary_sensor.py @@ -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)