kevinnaronha
New Around Here
I am looking for a way to trigger an IFTTT Maker channel request depending on WiFi presence (i.e., whether a device is connected to the router). I browsed around the forum and found a post that looks for connected MAC addresses and based on that carries out certain action. I tried to modify the same for my purpose as below and saved the following as CheckIFHome2 in /jffs/scripts/:
I changed the chmod to 777. I also copied the init-start script (chmod 777) in the /jffs/scripts folder:
I was hoping that the code will check if the two mac addresses are connected and will create the files RsHome AlHome depending on their presence status and that I will be able to trigger the Maker request using that information. However, the above is not working. I am not sure what am I missing....appreciate any advice....thanks!
Code:
#!/bin/sh
macadresser=`wl -i eth1 assoclist`
antal=`qcsapi_sockrpc get_count_assoc wifi0`
while [ $antal -gt 0 ]
do
antal=`expr $antal - 1`
macadresser="`qcsapi_sockrpc get_station_mac_addr wifi0 $antal`;$macadresser"
done
case "$macadresser" in
*CC:29:VV:XX:YY:ZZ*)
if [ ! -f /jffs/scripts/CheckUser/AlHome ]
then
touch /jffs/scripts/CheckUser/AlHome
curl -X POST "https://maker.ifttt.com/trigger/AlHome/with/key/API-KEY"
fi
;;
*04:F1:VV:XX:YY:ZZ*)
if [ ! -f /jffs/scripts/CheckUser/RsHome ]
then
touch /jffs/scripts/CheckUser/RsHome
fi
;;
*)
if [ -f /jffs/scripts/CheckUser/RsHome ]
then
rm -f /jffs/scripts/CheckUser/RsHome
fi
;;
if [ -f /jffs/scripts/CheckUser/AlHome ]
then
rm -f /jffs/scripts/CheckUser/AlHome
fi
;;
esac
I changed the chmod to 777. I also copied the init-start script (chmod 777) in the /jffs/scripts folder:
Code:
#!/bin/sh
cru a CheckIfHome "* * * * * /jffs/scripts/CheckIfHome2"
cru a CheckIfHome15 "* * * * * sleep 15; /jffs/scripts/CheckIfHome2"
cru a CheckIfHome30 "* * * * * sleep 30; /jffs/scripts/CheckIfHome2"
cru a CheckIfHome45 "* * * * * sleep 45; /jffs/scripts/CheckIfHome2"
I was hoping that the code will check if the two mac addresses are connected and will create the files RsHome AlHome depending on their presence status and that I will be able to trigger the Maker request using that information. However, the above is not working. I am not sure what am I missing....appreciate any advice....thanks!