Hi,
I need to detect when a device connects and disconnects from my local network.
I found a script which does exactly that and it works for the connect part:
Create /jffs/configs/dnsmasq.conf.add file with this line :
dhcp-script=/jffs/a/post-lease.sh
Create the /jffs/a/post-lease.sh with the below lines, and set the permissions to executable (chmod):
#!/bin/sh
NowLeasedMac=$2
if [ “$NowLeasedMac” == “11:22:33:44:55:66” ]; then
#Do what you want here when device connects
#e.g. I switch on-off my squeezebox player.
#wget http://192.168.100.50/cgi-bin/Squeezebox/SwitchOnOff.cmd
echo “Caught !”
fi
#
How can I send a trigger in the event a device drops off the network/disconnects??
Cheers,
Manuel
I need to detect when a device connects and disconnects from my local network.
I found a script which does exactly that and it works for the connect part:
Create /jffs/configs/dnsmasq.conf.add file with this line :
dhcp-script=/jffs/a/post-lease.sh
Create the /jffs/a/post-lease.sh with the below lines, and set the permissions to executable (chmod):
#!/bin/sh
NowLeasedMac=$2
if [ “$NowLeasedMac” == “11:22:33:44:55:66” ]; then
#Do what you want here when device connects
#e.g. I switch on-off my squeezebox player.
#wget http://192.168.100.50/cgi-bin/Squeezebox/SwitchOnOff.cmd
echo “Caught !”
fi
#
How can I send a trigger in the event a device drops off the network/disconnects??
Cheers,
Manuel