Compare commits

...

2 Commits

Author SHA1 Message Date
Andrey
e0eaafd0fa fix bugs 2021-02-18 10:40:09 +03:00
Andrey
51f3eb3b19 fix bugs 2021-02-18 10:23:27 +03:00
2 changed files with 11 additions and 12 deletions

View File

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

View File

@@ -198,14 +198,13 @@ class MegaD:
:return: :return:
""" """
for x in self.ds2413_ports: for x in self.ds2413_ports:
if x.http_cmd == 'ds2413': self.lg.debug(f'poll ds2413 for %s', x)
self.lg.debug(f'poll ds2413 for %s', x) await self.get_port(
await self.get_port( port=x,
port=x, force_http=True,
force_http=True, http_cmd='list',
http_cmd='list', conv=False
conv=False )
)
async def poll(self): async def poll(self):
""" """