fix binary sensors

This commit is contained in:
Andrey
2021-01-28 10:29:16 +03:00
parent 6d3391bc45
commit c36c1369aa
5 changed files with 34 additions and 11 deletions

View File

@@ -78,7 +78,10 @@ class MegaBinarySensor(BinarySensorEntity, MegaPushEntity):
if val is None and self._state is not None:
return self._state == 'ON'
elif val is not None:
return val == 'ON' or val != 1
if val in ['ON', 'OFF']:
return val == 'ON'
else:
return val != 1
def _update(self, payload: dict):
self.mega.values[self.port] = payload