mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-10 16:44:28 +05:00
fix
This commit is contained in:
@@ -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 = 8
|
||||
VERSION = 9
|
||||
CONNECTION_CLASS = config_entries.CONN_CLASS_ASSUMED
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
|
||||
@@ -258,7 +258,7 @@ class MegaD:
|
||||
async def save(self):
|
||||
await self.send_command(cmd='s')
|
||||
|
||||
def parse_response(self, ret):
|
||||
def parse_response(self, ret, cmd='get'):
|
||||
if ret is None:
|
||||
raise NoPort()
|
||||
if 'busy' in ret:
|
||||
@@ -266,7 +266,7 @@ class MegaD:
|
||||
if ':' in ret:
|
||||
if ';' in ret:
|
||||
ret = ret.split(';')
|
||||
elif '/' in ret:
|
||||
elif '/' in ret and not cmd == 'list':
|
||||
ret = ret.split('/')
|
||||
else:
|
||||
ret = [ret]
|
||||
@@ -291,7 +291,7 @@ class MegaD:
|
||||
if http_cmd == 'list' and conv:
|
||||
await self.request(pt=port, cmd='conv')
|
||||
await asyncio.sleep(1)
|
||||
ret = self.parse_response(await self.request(pt=port, cmd=http_cmd))
|
||||
ret = self.parse_response(await self.request(pt=port, cmd=http_cmd), cmd=http_cmd)
|
||||
ntry = 0
|
||||
while http_cmd == 'list' and ret is None and ntry < 3:
|
||||
await asyncio.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user