The Wifi Device Detect was created as a means to detect when certain wifi devices are on or off the wifi network. This information can be used to trigger certain events. Example: A husband and wife have their phones monitored by the program. They both leave for work in the morning. An event can be created that checks for a time when both devices have disconnected from the network and then set the home security system to armed. In the evening, the wife comes home and her phone connects to the wifi network. An event is triggered to disarm the home security system before she reaches for the door.
sudo apt-get update sudo apt-get install arp-scan -y
The Wifi Device Detect device driver reads from a configuration file located at /etc/opt/agocontrol/conf.d/wifi_device_detect.conf:
[wifi_device_detect] phoneaddress=a0:f0:00:a0:03:cd,45:61:36:b7:aa:42 devicename=androidphone,iphone wait_time=15 check_time=15
Note that the 'phoneaddress' variable is a comma separated list of MAC address of the devices to be monitored. The 'devicename' variable is a user-assignable name for each device. The order of 'devicename' must be the same as the corresponding MAC address in the 'phoneaddress' field. The 'wait_time' variable is the maximum time in minutes a device can be inactive before it is marked as away. The 'check_time' variable is the time in seconds between each checks to see if the device is currently on the network.
A binary sensor is created for each device and has the name specified in the 'devicename' variable. The binary sensor will be set to true if the device is connected to the network. The sensor will change to false if the device has been disconnected from the system after it exceeds the time set in the 'wait_time' variable. Initial state of the binary sensors is false on start up.