mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-12 17:44:28 +05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4af40c29a7 | ||
|
|
75a41c9667 | ||
|
|
4f8f38fde6 | ||
|
|
7e02797be8 |
@@ -57,7 +57,7 @@ async def validate_input(hass: core.HomeAssistant, data):
|
||||
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a config flow for mega."""
|
||||
|
||||
VERSION = 6
|
||||
VERSION = 7
|
||||
CONNECTION_CLASS = config_entries.CONN_CLASS_ASSUMED
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
|
||||
@@ -253,7 +253,7 @@ class MegaOutPort(MegaPushEntity):
|
||||
return self._state == 'ON'
|
||||
elif val is not None:
|
||||
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):
|
||||
self.mega.lg.warning(f'{self.entity_id}: {val} is not a dict')
|
||||
return
|
||||
|
||||
@@ -66,7 +66,7 @@ class MegaView(HomeAssistantView):
|
||||
update_all = False
|
||||
data['value'] = data.pop('v')
|
||||
data['mega_id'] = hub.id
|
||||
ret = 'd'
|
||||
ret = 'd' if hub.force_d else ''
|
||||
if port is not None:
|
||||
hub.values[port] = data
|
||||
for cb in self.callbacks[hub.id][port]:
|
||||
@@ -78,12 +78,13 @@ class MegaView(HomeAssistantView):
|
||||
template.hass = hass
|
||||
ret = template.async_render(data)
|
||||
_LOGGER.debug('response %s', ret)
|
||||
ret = Response(body='', content_type='text/plain', headers={'Server': 's', 'Date': 'n'})
|
||||
await hub.request(cmd=ret)
|
||||
Response(body='', content_type='text/plain', headers={'Server': 's', 'Date': 'n'})
|
||||
if ret:
|
||||
await hub.request(pt=port, cmd=ret)
|
||||
return ret
|
||||
|
||||
async def later_update(self, hub):
|
||||
_LOGGER.debug('force update')
|
||||
await asyncio.sleep(1)
|
||||
_LOGGER.debug('force update')
|
||||
await hub.updater.async_refresh()
|
||||
|
||||
|
||||
@@ -260,7 +260,10 @@ class MegaD:
|
||||
if 'busy' in ret:
|
||||
return None
|
||||
if ':' in ret:
|
||||
ret = ret.split(';')
|
||||
if ';' in ret:
|
||||
ret = ret.split(';')
|
||||
elif '/' in ret:
|
||||
ret = ret.split('/')
|
||||
ret = {'value': dict([
|
||||
x.split(':') for x in ret if x.count(':') == 1
|
||||
])}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
Обновление прошивки MegaD можно делать прямо из HA с помощью [аддона](https://github.com/andvikt/mega_addon.git)
|
||||
|
||||
Подробная документация по [ссылке](https://github.com/andvikt/mega_hacs/wiki)
|
||||
|
||||
Предложения по доработкам просьба писать в [discussions](https://github.com/andvikt/mega_hacs/discussions), о проблемах
|
||||
создавать [issue](https://github.com/andvikt/mega_hacs/issues/new/choose)
|
||||
## Основные особенности:
|
||||
- Настройка в веб-интерфейсе + yaml
|
||||
- Все порты автоматически добавляются как устройства (для обычных релейных выходов создается
|
||||
|
||||
Reference in New Issue
Block a user