Skip to content

Instantly share code, notes, and snippets.

@sideup66
Created July 23, 2021 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sideup66/dcbde12b8bc751f1e0e4705a67bc63f3 to your computer and use it in GitHub Desktop.
Save sideup66/dcbde12b8bc751f1e0e4705a67bc63f3 to your computer and use it in GitHub Desktop.
performs a simple pingcheck to see if a device is on the network or not. if not, turns on my iot away.
#this is a simple pingscript for my Wyze camera. It unfortunately has a flawed scheduling system where if i leave my house and turn on its
#motion detection, then a schedule for detection runs, if I am not home before the schedule ends, motion sensing will turn off.
#I use this script to determine if I am home by pinging my cellphone, if so, allow sensing to shut off, if not, turn it back on.
#Replace <dev_hostname> with your device's IP or hostname
#!/bin/sh
ping -c1 <dev_hostname> > /dev/null
if [ $? -eq 0 ]
then
echo "home, not turning on camera"
exit 0
else
echo âturning on cameraâ
<run your IoT commands here>
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment