Page 1 of 1
[suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 21 February 2016 15:36
by Siewert308SW
As we all know Domoticz uses the PING as system alive checker.
In the past this didn't work for me, device reported online while the aren't and vice versa.
My suggestion or question is if the ARP-scan could be implanted in Domoticz.
With options to set a delay before really triggering a switch when a device is off/online.
Mean reason for asking this some user don't/can't or like me issues with static ip ranges and need to configure every IP every week again.
ARP-Scan isn't depending on IP but on MAC addresses as everyone knows.
Is this a option or a no go?
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 21 February 2016 18:18
by jannl
Ping is not the problem I think, but the implementation in Domoticz. I use a ping script myself and that is running without problems for over a year now.
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 21 February 2016 18:21
by Siewert308SW
jannl wrote:Ping is not the problem I think, but the implementation in Domoticz. I use a ping script myself and that is running without problems for over a year now.
True, but some devices (also in my house) aren't pingable...
Also you don't have to rely on IPs as in my situation where my modem/router has a bug in the static ip config.
Was just a suggestion.
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 21 February 2016 18:23
by jannl
Just curious, why aren't they pingable?
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 21 February 2016 18:26
by Siewert308SW
jannl wrote:Just curious, why aren't they pingable?
God knows, device is connected to wifi and stays on wifi.
But after a certain time it doesn't respong to a ping while i can see it is online.
ARP is available and does respond on that.
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 21 February 2016 20:09
by ceedebee
Just use the lua script found here
http://www.domoticz.com/forum/viewtopic.php?f=23&t=5256
The only problem is that the script writes the uservariable every minute so I changed it a bit.
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Tuesday 23 February 2016 20:30
by Siewert308SW
At the moment i running your script for testing again.
I made a slight change to over the Lua Warning which says the script is running longer then 10 seconds.
I think the ARP-scan is taking to long to complete.
The ARP-scan shell command takes almost 5 seconds to complete.
I replaced the shell command
Code: Select all
sudo arp-scan --interface=eth0 192.168.xxx.1-192.168.xxx.yyy --retry=5 --ignoredups
to
arp -n takes less then a second to complete and didn't saw any lua warning in the log.
Hope arp-n will do the trick with the current presence for all my devices.
Can't test all my devices today but will see what happens overtime.
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Tuesday 23 February 2016 20:58
by jvdz
If I understand things correctly:
Don't think the arp command is the correct check as that just lists the current arp table of devices that connected to your server.
arp-scan actually check for the mac address on the network. with arp you have the risk the present device hasn't check it for a while thus wont show up in the output.
Thoughts?
Jos
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Tuesday 23 February 2016 21:01
by Siewert308SW
jvdz wrote:If I understand things correctly:
Don't think the arp command is the correct check as that just lists the current arp table of devices that connected to your server.
arp-scan actually check for the mac address on the network. with arp you have the risk the present device hasn't check it for a while thus wont show up in the output.
Thoughts?
Jos
Your thought is right, while digging into the arp documentation i discovered my phone was online while i disconnected the wifi several minutes a go. darn...
Digging into it further to see if i can fasten up the arp-scan check
Re: [suggestion] ARP-Scan instead of ping as system alive checker.
Posted: Sunday 17 April 2016 0:18
by thijsdebets
I wrote a shell script for my Raspberry Pi 2 to do this.
It uses arp-scan and a table to match discovered mac-addresses to actual dynamic ip-addresses and switches devices off on Domoticz when they are not discovered any more for a couple of minutes.
Install arp-scan:
sudo apt-get install arp-scan
git clone the script from
https://github.com/thijsdebets/networkdetectz
create a Dummy Hardware device and add the IDX to the config file
You can create 1 virtual switch and add the IDX also to the config file. This switch will be set ON when new devices are detected, Best is to set a notification when this switch turns on, so yo are aware of new devices in the network. Also have this switch run the nwd-backup.sh script when switching off, this will create backups of your config table.
A second 'reset arp' with 60 seconds off timer and ON script nwd-restore,sh allows you to restore the last correct config table, in case something goes wrong,
Add a line to crontab, so the script will run every minute,
crontab -e
*/1 * * * * /home/pi/domoticz/scripts/arp-detect.sh >> /dev/null 2>&1
It's probaly not perfect, but it detects my network devices pretty good.