After a conversation with my friend and a little thought here is the start of a simple solution I came up with while waiting for computers to do their job this afternoon.
Assume the following - you have x10 or similar home automation system. You own a smart phone. You have a home wifi network.
The solution looks like this:
- Add an x10 switch for the garage door.
- On your network - assign a fixed IP to your phone.
- On your linux server - use cron to run a script that pings for the address. When you get home and your phone connects to your network the script gets a ping response from your phone - it does an http put or get to your web based home control server to open the door (or just sends the appropriate heyu command if your linux box is also the automation server).
Cron entries - the first runs the script every minute for an hour starting at 5pm. At 6pm the second deletes the semaphore file created when the script opens the door (so it only opens the door once) to reset for the next day.
* 17 * * 1-5 /home/mydir/garage.sh 2>&1 1>/dev/null
0 18 * * 1-5 rm -f /home/mydir/garagedoor.txt 2>&1 1>/dev/null
The script - checks for the existence of the semaphore file. If it exists it exits, otherwise it sends a single ping and opens the door if there is a response. If it opens the door it creates the semaphore.
if [ ! -f /home/mydir/garagedoor.txt ]
then
if ping -c1 -q
then wget
touch
fi
fi
That's it. Of course you could take this as far as you want but this would at least wait for you to get home from work and open the door as a start.
No comments:
Post a Comment