mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-11 00:54:28 +05:00
fix http response and ds2413 bugs
This commit is contained in:
@@ -253,7 +253,7 @@ class MegaOutPort(MegaPushEntity):
|
|||||||
return self._state == 'ON'
|
return self._state == 'ON'
|
||||||
elif val is not None:
|
elif val is not None:
|
||||||
val = val.get("value")
|
val = val.get("value")
|
||||||
if self.index is not None and self.addr is not None:
|
if not isinstance(val, str) and self.index is not None and self.addr is not None:
|
||||||
if not isinstance(val, dict):
|
if not isinstance(val, dict):
|
||||||
self.mega.lg.warning(f'{self.entity_id}: {val} is not a dict')
|
self.mega.lg.warning(f'{self.entity_id}: {val} is not a dict')
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class MegaView(HomeAssistantView):
|
|||||||
update_all = False
|
update_all = False
|
||||||
data['value'] = data.pop('v')
|
data['value'] = data.pop('v')
|
||||||
data['mega_id'] = hub.id
|
data['mega_id'] = hub.id
|
||||||
ret = 'd'
|
ret = 'd' if hub.force_d else ''
|
||||||
if port is not None:
|
if port is not None:
|
||||||
hub.values[port] = data
|
hub.values[port] = data
|
||||||
for cb in self.callbacks[hub.id][port]:
|
for cb in self.callbacks[hub.id][port]:
|
||||||
@@ -79,7 +79,8 @@ class MegaView(HomeAssistantView):
|
|||||||
ret = template.async_render(data)
|
ret = template.async_render(data)
|
||||||
_LOGGER.debug('response %s', ret)
|
_LOGGER.debug('response %s', ret)
|
||||||
Response(body='', content_type='text/plain', headers={'Server': 's', 'Date': 'n'})
|
Response(body='', content_type='text/plain', headers={'Server': 's', 'Date': 'n'})
|
||||||
await hub.request(cmd=ret)
|
if ret:
|
||||||
|
await hub.request(cmd=ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
async def later_update(self, hub):
|
async def later_update(self, hub):
|
||||||
|
|||||||
Reference in New Issue
Block a user