#!/bin/sh mac=$1 idx=$2 device_present=Off domoticz_status=`curl -s "http://IPAddress:port/json.htm?type=devices&rid=$idx" | grep Status | awk '{print $3}' | sed 's/[",]//g'` # look in 2.4GHz (eth1) network for device for x in `wl -i eth1 assoclist | awk '{print $2}'`; do if [ $x = $mac ]; then device_present=On fi done # look in 5GHz (eth2) network for device for x in `wl -i eth2 assoclist | awk '{print $2}'`; do if [ $x = $mac ]; then device_present=On fi done # tell domoticz the new device status if [ $domoticz_status != $device_present ]; then if [ $device_present = "On" ]; then curl -s "http://IPAddress:port/json.htm?type=command¶m=switchlight&idx=$idx&switchcmd=On" > /dev/null else curl -s "http://IPAddress:port/json.htm?type=command¶m=switchlight&idx=$idx&switchcmd=Off" > /dev/null fi fi