Luci device scanner with ip address

Hi,

As some of my luci devices seem to not get deleted from the arp table, I’d like to automatically force an arp check, by ping’ing the device. For this I’d need the devices IP. As IP is part of the table, it could be made available in HA through the device scanner. (As is the case for the nmap scanner e.g.)

Could someone with skills please make the IP available as an attribute?

Thanks!

Andreas

I gave it a try myself: https://github.com/home-assistant/home-assistant/pull/17987

How is this working for you? I have had trouble with the Luci component also. Devices seem to get stuck and not updating correctly although my phone is showing right now that I am home in HA but the arp table on the router shows my flag correctly as 0x0. I can’t figure out why HA isn’t seeing the correct status. Whats your plan once you have the ip? set a cron job to ping it occasionally?

It’s working quite well now. I have added the additional fields to the sensor. I then use a template in a shell_script service as discussed here:


I call this service every 5 minutes from an automation.

In this way, I can periodically ping all devices on my network. The failing ping then also forces OpenWRT’s ARP table to update.

One caveat, I found out about later is my firewall, which didn’t actually allow home assistant to ping some devices failing to update. I have changed that only recently and I should know tonight if it works.

But, btw: Your problems seems different to mine. I had devices with 0x2 (= home) flags, although the devices were long offline. This was caused (I guess after some web research) by the NAT firewall keeping the MAC in its memory. If I ping’ed these devices, the router realized they were offline and changed the flag to 0x0 (=away). So, I think, this procedure will not help you, because your ARP table is already correct. It seems, you have a problem fetching the table from OpenWRT…

So, my first guess… There are a few timeouts in the home assistant configuration: https://www.home-assistant.io/components/device_tracker/. You might want to have a look at the consider_home parameter. Maybe that already solves your problem?

I am not 100% that was my problem. I just caught it one day when it showed my phone as 0x0 but HA didn’t seem to realize it. Usually its about 1x or 2x a week that one of the 2 phones doesn’t show as gone all day that messes up another automation. I don’t need device tracker to be very quick to react but right now sometimes things get stuck. Ill try your script and see what happens.

Ok I am looking at it more today and something weird is happening. HA has my wife as being home even though she left for work hours ago. So I thought I would login to openwrt and check the arp table on it. There are 2 entries for her MAC address. One is the 192.168.1.X address that has the flag of 0x0 and the other is an external ip address which is registered to her cell provider and that one has the 0x2 flag. So how can this arp entry get into Openwrt?