[suggestion] ARP-Scan instead of ping as system alive checker.

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

[suggestion] ARP-Scan instead of ping as system alive checker.

Post 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?
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
jannl
Posts: 666
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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.
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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.
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
jannl
Posts: 666
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post by jannl »

Just curious, why aren't they pingable?
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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.
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
ceedebee
Posts: 44
Joined: Sunday 08 March 2015 20:18
Target OS: -
Domoticz version:
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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.
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post by Siewert308SW »

ceedebee wrote: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.
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

Code: Select all

sudo arp -n
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.
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
User avatar
jvdz
Posts: 2269
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
Siewert308SW
Posts: 290
Joined: Monday 29 December 2014 15:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
User avatar
thijsdebets
Posts: 3
Joined: Friday 29 May 2015 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: [suggestion] ARP-Scan instead of ping as system alive checker.

Post 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.
v3.4834 on RPiB2
P1 Smartmeter
Onmik Solarpanel
Evohome heating
NAS WOL/SOL
KiKa: 14 switches + 3 PIR
Extra
Full LAN detection w. arpscan
TravelTime via GoogleMaps in TempGraph
Internet speed in Othergraph
Control
20 Blockly and 5 LUA scripts
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest