diff --git a/custom_components/mega/config_flow.py b/custom_components/mega/config_flow.py index b598c32..98d93ff 100644 --- a/custom_components/mega/config_flow.py +++ b/custom_components/mega/config_flow.py @@ -133,7 +133,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow): for x in PLATFORMS: cfg.pop(x, None) for x in REMOVE_CONFIG: - cfg.pop(x, default=None) + cfg.pop(x, None) cfg.update(new) cfg['new_naming'] = new_naming diff --git a/custom_components/mega/hub.py b/custom_components/mega/hub.py index b83f3f3..024e148 100644 --- a/custom_components/mega/hub.py +++ b/custom_components/mega/hub.py @@ -470,45 +470,6 @@ class MegaD: async def scan_port(self, port): data = await self.request(pt=port) return parse_config(data) - # async with self.lck: - # if port in self._scanned: - # return self._scanned[port] - # url = f'http://{self.host}/{self.sec}/?pt={port}' - # self.lg.debug( - # f'scan port %s: %s', port, url - # ) - # async with aiohttp.request('get', url) as req: - # html = await req.text() - # if req.status != 200: - # return - # tree = BeautifulSoup(html, features="lxml") - # pty = tree.find('select', attrs={'name': 'pty'}) - # if pty is None: - # return - # else: - # pty = pty.find(selected=True) - # if pty: - # pty = pty['value'] - # else: - # return - # if pty in ['0', '1']: - # m = tree.find('select', attrs={'name': 'm'}) - # if m: - # m = m.find(selected=True)['value'] - # self._scanned[port] = (pty, m) - # return pty, m - # elif pty == '3': - # m = tree.find('select', attrs={'name': 'd'}) - # if m: - # m = m.find(selected=True)['value'] - # self._scanned[port] = (pty, m) - # return pty, m - # elif pty in ('2', '4'): # эта часть не очень проработана, тут есть i2c который может работать неправильно - # m = tree.find('select', attrs={'name': 'd'}) - # if m: - # m = m.find(selected=True)['value'] - # self._scanned[port] = (pty, m or '0') - # return pty, m or '0' async def scan_ports(self, nports=37): for x in range(0, nports+1):