Skip to content
thijsdebets edited this page Jun 3, 2017 · 4 revisions

Welcome to the networkdetectz wiki! The tool to detect devices on the network for Domoticz

Background

Domoticz is a great Home Automation tool, which supports a lot of devices. Unfortunately it is limited in detecting networkdevices in the internal netwerk, while this can be a powerful source for your home automation.
I developed this shell script to run in the background of Domoticz, so that device detection is fully automated, and device detection is available in Domoticz, even when using dynamic IP addresses via DHCP.

System requirements

  • Linux on Raspberry Pi
  • Domoticz

Description

Domoticz does not support dynamic detection of network devices. This script will detect, register and track network devices.

Design

  • nwd-arpscan.sh: First an arp-scan will be executed into arp-scan.raw
  • From the arp-scan file, per mac address, it is checked if that mac address exists in data/arp-table.dom
  • If the mac address does not exits, the device name is added to Domoticz devices list as on/off switch. The MAC address and Domoticz IDX are added to arp-table.dom
  • Then for every mac address in arp-table.dom, it is checked if there is an associated ip-address in arp-scan.raw. If an ip address exists, the device is on. On no result, and there is no response to a ping or BlueTooth for the configured timeout period, the device is off.
  • Finally two HTML pages are created, so the status of devices can also be checked outside Domoticz on /tiles.html

Usage

Bluetooth address can be registered in the bluetooth.dom file.

Setup

Install arp-scan

sudo apt-get install arp-scan

Prepare Domoticz

Create a hardware of type Dummy, register the IDX in nwd-config

nano nwd-config

HardwareIDX=999
Create a Hardware switch for NewDevicedFound and add the IDX in nwd-config
NewDevicesFoundIDX=999
Create a Hardware switch for Running indicator, to see if the script is up. Set this indicator on 'Off-delay' 10 minutes
NWDScriptRunning=999

Set other configuration items in nwd-config:
DomoPIN='1234'
RetryAttempts=1 # 3 = retry 4 times (5 minutes), 1 = retry 2 = 3 minutes

Any updates to the configuration file will be automtically copied to the nwd-config.own, also for future changes, nwd will use your local settings stored in nwd-config.own

Prepare NetworkDetectz

make file executable

chmod 777 /home/pi/domoticz/networkdetectz/nwd-arpscan.sh

add nwd-arpscan to crontab:

crontab -e

*/1 * * * * /home/pi/domoticz/networkdetectz/nwd-arpscan.sh >> /dev/null 2>&1

Make sur your arp-scan will be updated with manufaturer information. Add to sudo crontab:

sudo crontab -e

@weekly cd /usr/share/arp-scan/ && get-oui @weekly cd /usr/share/arp-scan/ && get-iab