Async version for asuswrt#17692
Async version for asuswrt#17692balloob merged 2 commits intohome-assistant:devfrom kennedyshead:async_asuswrt
Conversation
|
Could you extract it into a small lib that we can depend on instead? |
|
Yes I might be able to, do you mean a smaller ssh-lib or a small asuswrt-lib? @balloob |
| from homeassistant.components.device_tracker.asuswrt import ( | ||
| CONF_PROTOCOL, CONF_MODE, CONF_PUB_KEY, DOMAIN, _ARP_REGEX, | ||
| CONF_PORT, PLATFORM_SCHEMA, Device, get_scanner, AsusWrtDeviceScanner, | ||
| CONF_PORT, PLATFORM_SCHEMA, Device, async_get_scanner, AsusWrtDeviceScanner, |
There was a problem hiding this comment.
line too long (80 > 79 characters)
| @@ -152,237 +100,9 @@ def _update_info(self): | |||
| return False | |||
There was a problem hiding this comment.
Nothing is checking this return value.
| data = self.get_asuswrt_data() | ||
| data = await self.connection.async_get_connected_devices() | ||
| if not data: | ||
| return False |
| return False | ||
|
|
||
| self.last_results = data | ||
| return True |
|
I don't think that redundant checks if data is returned is needed, the simpler the better ;) |
| self.username, self.password, self.ssh_key, | ||
| self.mode, self.require_ip) | ||
|
|
||
| self.last_results = {} |
There was a problem hiding this comment.
Do we need to reset this here? It's already initialized in init.
There was a problem hiding this comment.
You are right, that is just sloppy coding
|
I added all issues that are related to this as a possible fix for it, the lib issues should not be here anyway ;) |
| self.last_results = {} | ||
| self.success_init = False | ||
| self.connection = AsusWrt(self.host, self.port, | ||
| False if self.protocol == 'ssh' else True, |
There was a problem hiding this comment.
LOL! I broke my own PEP request!!!
|
amazing! |
Description:
This is a new async-version for asuswrt.
It will hopefully fix a lot of other errors with duplicate ssh-channels as well
Related issue (if applicable):
fixes #13723, fixes #17063 fixes #16887 fixes #13757 fixes #13351 fixes #10568
Checklist:
tox. Your PR cannot be merged unless tests passIf the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable ([example][ex-requir]).requirements_all.txtby runningscript/gen_requirements_all.py.