-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
device_tracker.asuswrt: Ignore unreachable ip neigh entries #12201
device_tracker.asuswrt: Ignore unreachable ip neigh entries #12201
Conversation
@@ -212,6 +212,10 @@ def _get_neigh(self, cur_devices): | |||
result = _parse_lines(lines, _IP_NEIGH_REGEX) | |||
devices = {} | |||
for device in result: | |||
status = device['status'] | |||
if status is not None: | |||
if state.upper() == 'STALE' or status.upper() == 'FAILED': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'state'
ead3b35
to
ca60c0a
Compare
ca60c0a
to
2a2e08b
Compare
2a2e08b
to
d353432
Compare
d353432
to
b812086
Compare
@@ -118,11 +119,10 @@ def __init__(self, config): | |||
if self.protocol == 'ssh': | |||
self.connection = SshConnection( | |||
self.host, self.port, self.username, self.password, | |||
self.ssh_key, self.mode == 'ap') | |||
self.ssh_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ap is still used, look at get_asuswrt_data()
please revert this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennedyshead That method uses only the mode
attribute of AsusWrtDeviceScanner. The ap
parameter of SshConnection (and TelnetConnection) is only used to set the attribute SshConnection._ap
. This is not needed and doesn't make sense as a property of the connection anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried running i AP mode with this pull-request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I'd say that this change should be done in a separate PR anyway
else: | ||
self.connection = TelnetConnection( | ||
self.host, self.port, self.username, self.password, | ||
self.mode == 'ap') | ||
self.host, self.port, self.username, self.password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -253,7 +256,7 @@ def disconnect(self): | |||
class SshConnection(_Connection): | |||
"""Maintains an SSH connection to an ASUS-WRT router.""" | |||
|
|||
def __init__(self, host, port, username, password, ssh_key, ap): | |||
def __init__(self, host, port, username, password, ssh_key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ap should not be removed
@@ -323,7 +325,7 @@ def disconnect(self): \ | |||
class TelnetConnection(_Connection): | |||
"""Maintains a Telnet connection to an ASUS-WRT router.""" | |||
|
|||
def __init__(self, host, port, username, password, ap): | |||
def __init__(self, host, port, username, password): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ap should not be removed
@@ -332,7 +334,6 @@ def __init__(self, host, port, username, password, ap): | |||
self._port = port | |||
self._username = username | |||
self._password = password | |||
self._ap = ap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ap should not be removed
This will also solve #12123 |
b812086
to
b7c8b65
Compare
@kennedyshead I've moved the other change to a separate PR. |
Ready to merge 🐬 |
Description:
device_tracker.asuswrt should consider entries in
ip neigh
output with STALE or FAILED status to be unreachable, so it can detect when devices with link-local IPv6 addresses are removed.Related issue (if applicable): fixes #12198
Checklist:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests pass