Skip to content
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 gives false positive on RT-AC86U #18465

Closed
bieniu opened this issue Nov 14, 2018 · 11 comments
Closed

device_tracker/asuswrt gives false positive on RT-AC86U #18465

bieniu opened this issue Nov 14, 2018 · 11 comments

Comments

@bieniu
Copy link
Member

bieniu commented Nov 14, 2018

Home Assistant release with the issue:
0.82

Last working Home Assistant release (if known):
unknown

Operating environment (Hass.io/Docker/Windows/etc.):
RPi3, Raspbian, Python 3.6.3 virtual_env

Component/platform:
device_tracker/asuswrt

Description of problem:
For some devices, the component gives a false positive home state when they are disconnected from the network. After rebooting the router they have not_home state but after reconnecting and disconnecting the state remains home for next router restart. Some problematic devices are wire, some wireless. My router model is RT-AC86U with Merlin firmware 384.7_2.
All my devices have a static IP address assigned by DHCP.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

- platform: asuswrt
  host: !secret router_hostname
  username: !secret router_username
  ssh_key: '/home/homeassistant/.ssh/id_rsa'
  protocol: ssh

Additional information:
One of the devices that have such problems is Dune media player. This is the result of the commands for this device when it is disconnected from the network.

arp -n | grep 00:16:xx:xx:xx:xx
? (192.168.2.60) at 00:16:xx:xx:xx:xx [ether]  on br0

cat /var/lib/misc/dnsmasq.leases | grep 00:16:xx:xx:xx:xx
36939 00:16:xx:xx:xx:xx 192.168.2.60 dune 01:00:16:xx:xx:xx:xx

ip neigh | grep 00:16:xx:xx:xx:xx
192.168.2.60 dev br0 lladdr 00:16:xx:xx:xx:xx STALE

Resault is false positive but the router in the web interface shows that the device isn't connected. I asked about it some time ago on the asuswrt-merlin forum and I got the answer that this method will not work on this router model (and all new models I think).

@kennedyshead
Copy link
Contributor

#18427

@cgarwood
Copy link
Member

Closing since #18427 was merged

@bieniu
Copy link
Member Author

bieniu commented Nov 15, 2018

@cgarwood @kennedyshead I installed aioasus 1.1.11. Unfortunately, it didn't help. All devices physically disconnected from the network have in HA state home. Issue should be reopen.

@kennedyshead
Copy link
Contributor

kennedyshead commented Nov 15, 2018

Are you 100% sure you do use 1.1.11? If you have an issue I think it should be dealt with in the component: https://github.com/kennedyshead/aioasuswrt

Install that test it with a script (you could find test in issues that are closed), any error would be great to have filed as bugs in that repo

@bieniu
Copy link
Member Author

bieniu commented Nov 15, 2018

I installed HA 0.83.0.dev0:

pip list | grep aioasuswrt
aioasuswrt              1.1.11

opera zdjecie_2018-11-15_163048_localhost
Devices marked with a green arrow are physically disconnected from the network but in HA they have state home. If I change the state of these devices manually to not_home, then the component restores the home state after a while.
My configuration:

asuswrt:
    host: 192.168.2.1
    username: !secret router_username
    protocol: ssh
    mode: router
    ssh_key: ~/.ssh/id_rsa

The result of running the script:

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:__main__:wl
INFO:asyncssh:Opening SSH connection to 192.168.2.1, port 22
INFO:asyncssh:[conn=0] Connection to 192.168.2.1, port 22 succeeded
INFO:asyncssh:[conn=0]   Local address: 192.168.2.200, port 57732
DEBUG:asyncssh:[conn=0] Requesting key exchange
DEBUG:asyncssh:[conn=0] Received key exchange request
DEBUG:asyncssh:[conn=0] Beginning key exchange
DEBUG:asyncssh:[conn=0] Completed key exchange
INFO:asyncssh:[conn=0] Beginning auth for user _redacted_
DEBUG:asyncssh:[conn=0] Trying password auth
INFO:asyncssh:[conn=0] Auth for user _redacted_ succeeded
DEBUG:asyncssh:[conn=0, chan=0] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=0] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=0]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && for dev in `nvram get wl_ifnames`; do wl -i $dev assoclist; done
INFO:asyncssh:[conn=0, chan=0] Received exit status 0
INFO:asyncssh:[conn=0, chan=0] Received channel close
INFO:asyncssh:[conn=0, chan=0] Channel closed
DEBUG:__main__:['assoclist F0:B4:xx:xx:xx:xx', 'assoclist 28:6C:xx:xx:xx:xx', 'assoclist 28:6C:xx:xx:xx:xx', 'assoclist 0C:E7:xx:xx:xx:xx', 'assoclist 0C:8B:xx:xx:xx:xx', 'assoclist A8:6B:xx:xx:xx:xx', 'assoclist 34:CE:xx:xx:xx:xx', 'assoclist 34:CE:xx:xx:xx:xx', 'assoclist 60:01:x:xx:xx:xx', 'assoclist 5C:CF:xx:xx:xx:xx', 'assoclist EC:FA:xx:xx:xx:xx', 'assoclist DC:4F:x:xx:xx:xx', 'assoclist 00:04x:xx:xx:xx', 'assoclist 28:6C:xx:xx:xx:xx', 'assoclist 78:11:xx:xx:xx:xx', 'assoclist 64:A2:xx:xx:xx:xx', 'assoclist 98:E0:xx:xx:xx:xx', 'assoclist D4:A3:xx:xx:xx:xx', 'assoclist 00:9E:xx:xx:xx:xx', '']
DEBUG:asyncssh:[conn=0, chan=1] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=1] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=1]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && for dev in `nvram get wl1_vifs && nvram get wl0_vifs && nvram get wl_ifnames`; do if type wlanconfig > /dev/null; then wlanconfig $dev list | awk 'FNR > 1 {print substr($1, 0, 18)}'; else wl -i $dev assoclist; fi; done
INFO:asyncssh:[conn=0, chan=1] Received exit status 0
INFO:asyncssh:[conn=0, chan=1] Received channel close
INFO:asyncssh:[conn=0, chan=1] Channel closed
DEBUG:__main__:{'F0:B4:xx:xx:xx:xx': Device(mac='F0:B4:xx:xx:xx:xx', ip=None, name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip=None, name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip=None, name=None), '0C:E7:xx:xx:xx:xx': Device(mac='0C:E7:xx:xx:xx:xx', ip=None, name=None), '0C:8B:xx:xx:xx:xx': Device(mac='0C:8B:xx:xx:xx:xx', ip=None, name=None), 'A8:6B:xx:xx:xx:xx': Device(mac='A8:6B:xx:xx:xx:xx', ip=None, name=None), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip=None, name=None), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip=None, name=None), '60:01:x:xx:xx:xx': Device(mac='60:01:x:xx:xx:xx', ip=None, name=None), '5C:CF:xx:xx:xx:xx': Device(mac='5C:CF:xx:xx:xx:xx', ip=None, name=None), 'EC:FA:xx:xx:xx:xx': Device(mac='EC:FA:xx:xx:xx:xx', ip=None, name=None), 'DC:4F:x:xx:xx:xx': Device(mac='DC:4F:x:xx:xx:xx', ip=None, name=None), '00:04x:xx:xx:xx': Device(mac='00:04x:xx:xx:xx', ip=None, name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip=None, name=None), '78:11:xx:xx:xx:xx': Device(mac='78:11:xx:xx:xx:xx', ip=None, name=None), '64:A2:xx:xx:xx:xx': Device(mac='64:A2:xx:xx:xx:xx', ip=None, name=None), '98:E0:xx:xx:xx:xx': Device(mac='98:E0:xx:xx:xx:xx', ip=None, name=None), 'D4:A3:xx:xx:xx:xx': Device(mac='D4:A3:xx:xx:xx:xx', ip=None, name=None), '00:9E:xx:xx:xx:xx': Device(mac='00:9E:xx:xx:xx:xx', ip=None, name=None)}
DEBUG:__main__:arp
DEBUG:asyncssh:[conn=0, chan=2] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=2] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=2]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && arp -n
INFO:asyncssh:[conn=0, chan=2] Received exit status 0
INFO:asyncssh:[conn=0, chan=2] Received channel close
INFO:asyncssh:[conn=0, chan=2] Channel closed
DEBUG:__main__:['? (192.168.2.10) at 00:11:x:xx:xx:xx [ether]  on br0', '? (192.168.2.200) at 0C:8B:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.120) at 00:9E:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.140) at 64:A2:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.160) at 0C:E7:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.60) at A0:F3:x:xx:xx:xx [ether]  on br0', '? (192.168.2.243) at DC:4F:x:xx:xx:xx [ether]  on br0', '? (192.168.2.244) at 28:6C:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.80) at <incomplete>  on br0', '? (192.168.2.2) at A0:F3:x:xx:xx:xx [ether]  on br0', '? (192.168.2.100) at A8:6B:xx:xx:xx:xx [ether]  on br0', '? (192.168.100.1) at 14:60:x:xx:xx:xx [ether]  on eth0', '? (192.168.2.189) at <incomplete>  on br0', '? (192.168.2.20) at B8:27:x:xx:xx:xx [ether]  on br0', '? (192.168.2.190) at <incomplete>  on br0', '? (192.168.2.40) at 00:05:x:xx:xx:xx [ether]  on br0', '? (192.168.2.210) at <incomplete>  on br0', '? (192.168.2.241) at EC:FA:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.150) at D4:A3:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.242) at 60:01:x:xx:xx:xx [ether]  on br0', '? (192.168.2.247) at 78:11:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.248) at 34:CE:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.170) at 98:E0:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.90) at F0:B4:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.110) at 00:04x:xx:xx:xx [ether]  on br0', '? (192.168.2.121) at C0:EE:x:xx:xx:xx [ether]  on br0', '? (192.168.2.130) at 34:CE:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.30) at <incomplete>  on br0', '? (192.168.2.50) at F8:46:x:xx:xx:xx [ether]  on br0', '? (192.168.2.240) at 5C:CF:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.245) at 28:6C:xx:xx:xx:xx [ether]  on br0', '? (192.168.2.3) at F0:23:x:xx:xx:xx [ether]  on br0', '? (192.168.2.246) at 28:6C:xx:xx:xx:xx [ether]  on br0', '']
DEBUG:asyncssh:[conn=0, chan=3] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=3] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=3]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && arp -n
INFO:asyncssh:[conn=0, chan=3] Received exit status 0
INFO:asyncssh:[conn=0, chan=3] Received channel close
INFO:asyncssh:[conn=0, chan=3] Channel closed
DEBUG:aioasuswrt.asuswrt:Could not parse row: ? (192.168.2.80) at <incomplete>  on br0
DEBUG:aioasuswrt.asuswrt:Could not parse row: ? (192.168.2.189) at <incomplete>  on br0
DEBUG:aioasuswrt.asuswrt:Could not parse row: ? (192.168.2.190) at <incomplete>  on br0
DEBUG:aioasuswrt.asuswrt:Could not parse row: ? (192.168.2.210) at <incomplete>  on br0
DEBUG:aioasuswrt.asuswrt:Could not parse row: ? (192.168.2.30) at <incomplete>  on br0
DEBUG:__main__:{'F0:B4:xx:xx:xx:xx': Device(mac='F0:B4:xx:xx:xx:xx', ip='192.168.2.90', name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.245', name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.244', name=None), '0C:E7:xx:xx:xx:xx': Device(mac='0C:E7:xx:xx:xx:xx', ip='192.168.2.160', name=None), '0C:8B:xx:xx:xx:xx': Device(mac='0C:8B:xx:xx:xx:xx', ip='192.168.2.200', name=None), 'A8:6B:xx:xx:xx:xx': Device(mac='A8:6B:xx:xx:xx:xx', ip='192.168.2.100', name=None), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip='192.168.2.248', name=None), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip='192.168.2.130', name=None), '60:01:x:xx:xx:xx': Device(mac='60:01:x:xx:xx:xx', ip='192.168.2.242', name=None), '5C:CF:xx:xx:xx:xx': Device(mac='5C:CF:xx:xx:xx:xx', ip='192.168.2.240', name=None), 'EC:FA:xx:xx:xx:xx': Device(mac='EC:FA:xx:xx:xx:xx', ip='192.168.2.241', name=None), 'DC:4F:x:xx:xx:xx': Device(mac='DC:4F:x:xx:xx:xx', ip='192.168.2.243', name=None), '00:04x:xx:xx:xx': Device(mac='00:04x:xx:xx:xx', ip='192.168.2.110', name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.246', name=None), '78:11:xx:xx:xx:xx': Device(mac='78:11:xx:xx:xx:xx', ip='192.168.2.247', name=None), '64:A2:xx:xx:xx:xx': Device(mac='64:A2:xx:xx:xx:xx', ip='192.168.2.140', name=None), '98:E0:xx:xx:xx:xx': Device(mac='98:E0:xx:xx:xx:xx', ip='192.168.2.170', name=None), 'D4:A3:xx:xx:xx:xx': Device(mac='D4:A3:xx:xx:xx:xx', ip='192.168.2.150', name=None), '00:9E:xx:xx:xx:xx': Device(mac='00:9E:xx:xx:xx:xx', ip='192.168.2.120', name=None), '00:11:x:xx:xx:xx': Device(mac='00:11:x:xx:xx:xx', ip='192.168.2.10', name=None), 'A0:F3:x:xx:xx:xx': Device(mac='A0:F3:x:xx:xx:xx', ip='192.168.2.60', name=None), 'A0:F3:x:xx:xx:xx': Device(mac='A0:F3:x:xx:xx:xx', ip='192.168.2.2', name=None), '14:60:x:xx:xx:xx': Device(mac='14:60:x:xx:xx:xx', ip='192.168.100.1', name=None), 'B8:27:x:xx:xx:xx': Device(mac='B8:27:x:xx:xx:xx', ip='192.168.2.20', name=None), '00:05:x:xx:xx:xx': Device(mac='00:05:x:xx:xx:xx', ip='192.168.2.40', name=None), 'C0:EE:x:xx:xx:xx': Device(mac='C0:EE:x:xx:xx:xx', ip='192.168.2.121', name=None), 'F8:46:x:xx:xx:xx': Device(mac='F8:46:x:xx:xx:xx', ip='192.168.2.50', name=None), 'F0:23:x:xx:xx:xx': Device(mac='F0:23:x:xx:xx:xx', ip='192.168.2.3', name=None)}
DEBUG:__main__:neigh
DEBUG:asyncssh:[conn=0, chan=4] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=4] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=4]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && ip neigh
INFO:asyncssh:[conn=0, chan=4] Received exit status 0
INFO:asyncssh:[conn=0, chan=4] Received channel close
INFO:asyncssh:[conn=0, chan=4] Channel closed
DEBUG:__main__:['192.168.2.10 dev br0 lladdr 00:11:x:xx:xx:xx REACHABLE', '192.168.2.200 dev br0 lladdr 0C:8B:xx:xx:xx:xx REACHABLE', '192.168.2.120 dev br0 lladdr 00:9E:xx:xx:xx:xx REACHABLE', '192.168.2.140 dev br0 lladdr 64:A2:xx:xx:xx:xx REACHABLE', '192.168.2.160 dev br0 lladdr 0C:E7:xx:xx:xx:xx STALE', '192.168.2.60 dev br0 lladdr A0:F3:x:xx:xx:xx STALE', '192.168.2.243 dev br0 lladdr DC:4F:x:xx:xx:xx STALE', '192.168.2.244 dev br0 lladdr 28:6C:xx:xx:xx:xx STALE', '192.168.2.80 dev br0  FAILED', '192.168.2.2 dev br0 lladdr A0:F3:x:xx:xx:xx STALE', '192.168.2.100 dev br0 lladdr A8:6B:xx:xx:xx:xx STALE', '192.168.100.1 dev eth0 lladdr 14:60:x:xx:xx:xx REACHABLE', '192.168.2.189 dev br0  FAILED', '192.168.2.20 dev br0 lladdr B8:27:x:xx:xx:xx REACHABLE', '192.168.2.190 dev br0  FAILED', '192.168.2.40 dev br0 lladdr 00:05:x:xx:xx:xx STALE', '192.168.2.210 dev br0  FAILED', '192.168.2.241 dev br0 lladdr EC:FA:xx:xx:xx:xx STALE', '192.168.2.150 dev br0 lladdr D4:A3:xx:xx:xx:xx REACHABLE', '192.168.2.242 dev br0 lladdr 60:01:x:xx:xx:xx STALE', '192.168.2.247 dev br0 lladdr 78:11:xx:xx:xx:xx STALE', '192.168.2.248 dev br0 lladdr 34:CE:xx:xx:xx:xx STALE', '192.168.2.170 dev br0 lladdr 98:E0:xx:xx:xx:xx REACHABLE', '192.168.2.90 dev br0 lladdr F0:B4:xx:xx:xx:xx STALE', '192.168.2.110 dev br0 lladdr 00:04x:xx:xx:xx DELAY', '192.168.2.121 dev br0 lladdr C0:EE:x:xx:xx:xx STALE', '192.168.2.130 dev br0 lladdr 34:CE:xx:xx:xx:xx STALE', '192.168.2.30 dev br0  FAILED', '192.168.2.50 dev br0 lladdr F8:46:x:xx:xx:xx STALE', '192.168.2.240 dev br0 lladdr 5C:CF:xx:xx:xx:xx STALE', '192.168.2.245 dev br0 lladdr 28:6C:xx:xx:xx:xx STALE', '192.168.2.3 dev br0 lladdr F0:23:x:xx:xx:xx STALE', '192.168.2.246 dev br0 lladdr 28:6C:xx:xx:xx:xx STALE', '']
DEBUG:asyncssh:[conn=0, chan=5] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=5] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=5]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && ip neigh
INFO:asyncssh:[conn=0, chan=5] Received exit status 0
INFO:asyncssh:[conn=0, chan=5] Received channel close
INFO:asyncssh:[conn=0, chan=5] Channel closed
DEBUG:__main__:{'F0:B4:xx:xx:xx:xx': Device(mac='F0:B4:xx:xx:xx:xx', ip='192.168.2.90', name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.245', name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.244', name=None), '0C:E7:xx:xx:xx:xx': Device(mac='0C:E7:xx:xx:xx:xx', ip='192.168.2.160', name=None), '0C:8B:xx:xx:xx:xx': Device(mac='0C:8B:xx:xx:xx:xx', ip='192.168.2.200', name=None), 'A8:6B:xx:xx:xx:xx': Device(mac='A8:6B:xx:xx:xx:xx', ip='192.168.2.100', name=None), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip='192.168.2.248', name=None), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip='192.168.2.130', name=None), '60:01:x:xx:xx:xx': Device(mac='60:01:x:xx:xx:xx', ip='192.168.2.242', name=None), '5C:CF:xx:xx:xx:xx': Device(mac='5C:CF:xx:xx:xx:xx', ip='192.168.2.240', name=None), 'EC:FA:xx:xx:xx:xx': Device(mac='EC:FA:xx:xx:xx:xx', ip='192.168.2.241', name=None), 'DC:4F:x:xx:xx:xx': Device(mac='DC:4F:x:xx:xx:xx', ip='192.168.2.243', name=None), '00:04x:xx:xx:xx': Device(mac='00:04x:xx:xx:xx', ip='192.168.2.110', name=None), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.246', name=None), '78:11:xx:xx:xx:xx': Device(mac='78:11:xx:xx:xx:xx', ip='192.168.2.247', name=None), '64:A2:xx:xx:xx:xx': Device(mac='64:A2:xx:xx:xx:xx', ip='192.168.2.140', name=None), '98:E0:xx:xx:xx:xx': Device(mac='98:E0:xx:xx:xx:xx', ip='192.168.2.170', name=None), 'D4:A3:xx:xx:xx:xx': Device(mac='D4:A3:xx:xx:xx:xx', ip='192.168.2.150', name=None), '00:9E:xx:xx:xx:xx': Device(mac='00:9E:xx:xx:xx:xx', ip='192.168.2.120', name=None), '00:11:x:xx:xx:xx': Device(mac='00:11:x:xx:xx:xx', ip='192.168.2.10', name=None), 'A0:F3:x:xx:xx:xx': Device(mac='A0:F3:x:xx:xx:xx', ip='192.168.2.60', name=None), 'A0:F3:x:xx:xx:xx': Device(mac='A0:F3:x:xx:xx:xx', ip='192.168.2.2', name=None), '14:60:x:xx:xx:xx': Device(mac='14:60:x:xx:xx:xx', ip='192.168.100.1', name=None), 'B8:27:x:xx:xx:xx': Device(mac='B8:27:x:xx:xx:xx', ip='192.168.2.20', name=None), '00:05:x:xx:xx:xx': Device(mac='00:05:x:xx:xx:xx', ip='192.168.2.40', name=None), 'C0:EE:x:xx:xx:xx': Device(mac='C0:EE:x:xx:xx:xx', ip='192.168.2.121', name=None), 'F8:46:x:xx:xx:xx': Device(mac='F8:46:x:xx:xx:xx', ip='192.168.2.50', name=None), 'F0:23:x:xx:xx:xx': Device(mac='F0:23:x:xx:xx:xx', ip='192.168.2.3', name=None)}
DEBUG:__main__:leases
DEBUG:asyncssh:[conn=0, chan=6] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=6] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=6]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && cat /var/lib/misc/dnsmasq.leases
INFO:asyncssh:[conn=0, chan=6] Received exit status 0
INFO:asyncssh:[conn=0, chan=6] Received channel close
INFO:asyncssh:[conn=0, chan=6] Channel closed
DEBUG:__main__:['70168 44:85:xx:xx:xx:xx 192.168.2.210 laptop-edyta 01:44:85:xx:xx:xx:xx', '69987 d4:xx:xx:xx:xx:xx 192.168.2.150 iphone 01:d4:xx:xx:xx:xx:xx', '64245 00:11:x:xx:xx:xx 192.168.2.10 synology 01:00:11:x:xx:xx:xx', '47570 F0:23:x:xx:xx:xx 192.168.2.3 fingbox ff:54:cc:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx', '84942 B8:27:x:xx:xx:xx 192.168.2.20 raspberry 01:B8:27:x:xx:xx:xx', '73278 A0:F3:x:xx:xx:xx 192.168.2.2 switch *', '68204 00:05:x:xx:xx:xx 192.168.2.40 denon 01:00:05:x:xx:xx:xx', '68420 00:04x:xx:xx:xx 192.168.2.110 harmony 01:00:04x:xx:xx:xx', '57128 34:CE:xx:xx:xx:xx 192.168.2.248 shelly1 *', '85999 F0:B4:xx:xx:xx:xx 192.168.2.90 migateway *', '67320 28:6c:xx:xx:xx:xx 192.168.2.246 yeelight-lightstrip-1 *', '66839 78:11:xx:xx:xx:xx 192.168.2.247 yeelight-lightstrip-2 *', '60676 F8:46:x:xx:xx:xx 192.168.2.50 playstation 01:F8:46:x:xx:xx:xx', '62287 A8:6B:xx:xx:xx:xx 192.168.2.100 brother 01:A8:6B:xx:xx:xx:xx', '83403 64:a2:xx:xx:xx:xx 192.168.2.140 oneplus 01:64:a2:xx:xx:xx:xx', '68481 00:9e:xx:xx:xx:xx 192.168.2.120 mibox 01:00:xx:xx:xx:xx:xx', '53285 5C:CF:xx:xx:xx:xx 192.168.2.240 sonoff-basic-1 *', '79231 DC:4F:x:xx:xx:xx 192.168.2.243 wemos-d1-mini *', '53294 60:01:x:xx:xx:xx 192.168.2.242 sonoff-basic-3 *', '70706 98:e0:xx:xx:xx:xx 192.168.2.170 ipad 01:98:xx:xx:xx:xx:xx', '52400 EC:FA:xx:xx:xx:xx 192.168.2.241 sonoff-basic-2 *', '63639 34:CE:xx:xx:xx:xx 192.168.2.130 dafang 01:34:CE:xx:xx:xx:xx', '70204 0C:E7:xx:xx:xx:xx 192.168.2.160 lumia 01:0C:E7:xx:xx:xx:xx', '84156 28:6C:xx:xx:xx:xx 192.168.2.244 yeelight-color-bulb-1 *', '84156 28:6C:xx:xx:xx:xx 192.168.2.245 yeelight-color-bulb-2 *', '54354 40:16:xx:xx:xx:xx 192.168.2.30 stacjonarny 01:40:16:xx:xx:xx:xx', '70194 0C:8B:xx:xx:xx:xx 192.168.2.200 laptop 01:0C:8B:xx:xx:xx:xx', '']
DEBUG:asyncssh:[conn=0, chan=7] Set write buffer limits: low-water=16384, high-water=65536
INFO:asyncssh:[conn=0, chan=7] Requesting new SSH session
INFO:asyncssh:[conn=0, chan=7]   Command: PATH=$PATH:/bin:/usr/sbin:/sbin && cat /var/lib/misc/dnsmasq.leases
INFO:asyncssh:[conn=0, chan=7] Received exit status 0
INFO:asyncssh:[conn=0, chan=7] Received channel close
INFO:asyncssh:[conn=0, chan=7] Channel closed
DEBUG:__main__:{'F0:B4:xx:xx:xx:xx': Device(mac='F0:B4:xx:xx:xx:xx', ip='192.168.2.90', name='migateway'), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.245', name='yeelight-color-bulb-2'), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.244', name='yeelight-color-bulb-1'), '0C:E7:xx:xx:xx:xx': Device(mac='0C:E7:xx:xx:xx:xx', ip='192.168.2.160', name='lumia'), '0C:8B:xx:xx:xx:xx': Device(mac='0C:8B:xx:xx:xx:xx', ip='192.168.2.200', name='laptop'), 'A8:6B:xx:xx:xx:xx': Device(mac='A8:6B:xx:xx:xx:xx', ip='192.168.2.100', name='brother'), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip='192.168.2.248', name='shelly1'), '34:CE:xx:xx:xx:xx': Device(mac='34:CE:xx:xx:xx:xx', ip='192.168.2.130', name='dafang'), '60:01:x:xx:xx:xx': Device(mac='60:01:x:xx:xx:xx', ip='192.168.2.242', name='sonoff-basic-3'), '5C:CF:xx:xx:xx:xx': Device(mac='5C:CF:xx:xx:xx:xx', ip='192.168.2.240', name='sonoff-basic-1'), 'EC:FA:xx:xx:xx:xx': Device(mac='EC:FA:xx:xx:xx:xx', ip='192.168.2.241', name='sonoff-basic-2'), 'DC:4F:x:xx:xx:xx': Device(mac='DC:4F:x:xx:xx:xx', ip='192.168.2.243', name='wemos-d1-mini'), '00:04x:xx:xx:xx': Device(mac='00:04x:xx:xx:xx', ip='192.168.2.110', name='harmony'), '28:6C:xx:xx:xx:xx': Device(mac='28:6C:xx:xx:xx:xx', ip='192.168.2.246', name='yeelight-lightstrip-1'), '78:11:xx:xx:xx:xx': Device(mac='78:11:xx:xx:xx:xx', ip='192.168.2.247', name='yeelight-lightstrip-2'), '64:A2:xx:xx:xx:xx': Device(mac='64:A2:xx:xx:xx:xx', ip='192.168.2.140', name='oneplus'), '98:E0:xx:xx:xx:xx': Device(mac='98:E0:xx:xx:xx:xx', ip='192.168.2.170', name='ipad'), 'D4:A3:xx:xx:xx:xx': Device(mac='D4:A3:xx:xx:xx:xx', ip='192.168.2.150', name='iphone'), '00:9E:xx:xx:xx:xx': Device(mac='00:9E:xx:xx:xx:xx', ip='192.168.2.120', name='mibox'), '00:11:x:xx:xx:xx': Device(mac='00:11:x:xx:xx:xx', ip='192.168.2.10', name='synology'), 'A0:F3:x:xx:xx:xx': Device(mac='A0:F3:x:xx:xx:xx', ip='192.168.2.60', name=None), 'A0:F3:x:xx:xx:xx': Device(mac='A0:F3:x:xx:xx:xx', ip='192.168.2.2', name='switch'), '14:60:x:xx:xx:xx': Device(mac='14:60:x:xx:xx:xx', ip='192.168.100.1', name=None), 'B8:27:x:xx:xx:xx': Device(mac='B8:27:x:xx:xx:xx', ip='192.168.2.20', name='raspberry'), '00:05:x:xx:xx:xx': Device(mac='00:05:x:xx:xx:xx', ip='192.168.2.40', name='denon'), 'C0:EE:x:xx:xx:xx': Device(mac='C0:EE:x:xx:xx:xx', ip='192.168.2.121', name=None), 'F8:46:x:xx:xx:xx': Device(mac='F8:46:x:xx:xx:xx', ip='192.168.2.50', name='playstation'), 'F0:23:x:xx:xx:xx': Device(mac='F0:23:x:xx:xx:xx', ip='192.168.2.3', name='fingbox')}

@kennedyshead
Copy link
Contributor

How long time is it online, there is an unfortunate "delay" in the connection.

@bieniu
Copy link
Member Author

bieniu commented Nov 15, 2018

Device dune (wire) is offline for 2 days (so shows Fingbox which scans devices on the network):

screenshot_20181115-195917 2
In HA with asuswrt component it has state home almost all the time (w domu means home):

image

Another (wireless) device jerzy is offline for 2 days:

screenshot_20181115-200637 2
I na HA this device is almost online all the time:

image

@budbay
Copy link

budbay commented Dec 16, 2018

@bieniu did you ever solve this? I've have the same issue and been searching for answers. I just got a Asus ac86u and flashed Merlin's latest stable and latest home assistant 84.2. The issue is with an iPhone, if I turn off WiFi it will switch to away but whenever the iPhone leaves the house it always shows home. Android devices work perfectly. Any help would be appreciated.

@bieniu
Copy link
Member Author

bieniu commented Dec 16, 2018

@budbay No, I didn't solve the issue. The component still for several devices displays the home status all the time when these devices are disconnected from the network. Unfortunately, it seems to me that for AC86U and AX88U this component will not work properly because the command results on the router give incorrect results (false positives). I think that this issue should be reopened.

@budbay
Copy link

budbay commented Dec 18, 2018

@bieniu i agree i would like to see this reopened, however im starting to think that this is related to merlin firmware possibly. im unsure how to use the aioasuswrt test scripts so i used several methods to do some testing. i took and older version of the device tracker from another issue thread so i could more easily modify it in custom_components for testing(https://pastebin.com/JHew4djg). i checked each individual command by removing all but one from

        devices.update(self._get_wl())
        devices.update(self._get_arp())
        devices.update(self._get_neigh(devices))
        if not self.mode == 'ap':
            devices.update(self._get_leases(devices)) 

get_wl gives output like "assoclist xx:xx:xx:xx:A0:B0" and since there is no ip listed with it, it is ignored by this block

        for key in devices:
            if self.mode == 'ap' or devices[key].ip is not None:
                ret_devices[key] = devices[key]
        return ret_devices

so i removed the "if" line and retested then i get accurate detection from wifi, i then moved on to try get_neigh which worked as expected however devices come and go offline frequently when not sending traffic. so i then ran the device_tracker for a day using just

       devices.update(self._get_wl())
       devices.update(self._get_neigh(devices))

and now i was getting accurate detection from my wifi devices. so next i started playing with just using get_arp, this is where i think the problem lies. first i found that some devices were not reporting correctly in hass and i saw
DEBUG:aioasuswrt.asuswrt:Could not parse row: ? (192.168.2.80) at <incomplete> on br0
in your logs, so the devices that are incomplete should be away but nothing seems to be happening so i edited the line in

def _get_arp(self):
if device['mac'] is not None:

to

if device['mac'] is not "<incomplete>":

this seemed to help but i was still having issues with an iphone that would not show away if it leaves the house. so after monitoring the commands during the events i found that while the device is no longer connected, "arp -n" still shows

? (192.168.1.130) at xx:xx:xx:xx:xx:xx [ether]  on br0

note that it does not show as "incomplete" like other disconnected devices, but it is gone from get_wl and stale from get_neigh, so something may be wrong with the way the router is handling a device that does not disconnect from network "gracefully". i am starting to exhaust my limited ability to understand these things and was hoping to further a dialog to help figure this out. i know my approach is "ugly" as im just hacking apart on ald device_tracker but at this point thats all i could figure out. so for now im just using wl and neigh for wireless presence and all is working. i hope this can help move forward with this. i apologize if this was too long or should be posted else where, i am open to such feedback.

@kennedyshead
Copy link
Contributor

This is not a bug in home assistant, its a bug in aioasuswrt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants