This commit is contained in:
Andrey
2021-02-17 22:01:33 +03:00
parent 4fe2469a01
commit fcce9dcfc1

View File

@@ -251,20 +251,20 @@ class MegaOutPort(MegaPushEntity):
val = val.get("value")
if self.index and self.addr:
if not isinstance(val, dict):
self.mega.lg.warning(f'{self} has wrong state: {val}')
self.mega.lg.warning(f'{self.entity_id} has wrong state: {val}')
return
_val = val.get(self.addr)
if not isinstance(val, str):
self.mega.lg.warning(f'{self} has wrong state: {val}')
self.mega.lg.warning(f'{self.entity_id} has wrong state: {val}')
return
_val = _val.split('/')
if len(_val) >= 2:
val = val[self.index]
else:
self.mega.lg.warning(f'{self} has wrong state: {val}')
self.mega.lg.warning(f'{self.entity_id} has wrong state: {val}')
return
elif self.index and self.addr is None:
self.mega.lg.warning(f'{self} does not has addr')
self.mega.lg.warning(f'{self.entity_id} does not has addr')
return
if not self.invert: