I have what I consider to be a pretty extensive Home Automation setup.
I use the program HomeAssistant on a Raspberry Pi3 with an Aeotech ZWave controller . Also I have some wifi devices such as a Nest Thermostat, Ring Doorbell, Ethernet Security Cameras, a WiFi Light Switch, and some smart light bulbs.
In a nutshell though it is all mostly run through the network. If the network dies (power outage) then everything is dead. I have a WiFI router that runs OpenWRT which is ROCK SOLID STABLE. It has NEVER crashed. Recently I went on a 4 day trip and guess what? It crashed. Some elements of my home network were still functional (ethernet devices), but anything that went through wifi was compromised. Fortunately, my sweetheart has a key to my house (and my heart) and a quick “Hey Honey will you go restart the router” text solved the problem.
That’s all good and well but I have some automations that run when certain things happen. Ring my doorbell and lights start popping on all over the place in timed intervals. At sunset some lights come on, at sunrise they go off. All of that stuff has the potential to be screwed up if the network crashes or power pops off.
So I got to thinking I need something a little more robust if for nothing else but to turn ONE LIGHT ON, or turn ONE STEREO on to make noise…………or some other functions that make it look like someone is at home that will likely shoot you if you are up to no good.
So I’m walking around the store the other day and I see a remote controlled power outlet made by GE.
I know for a fact these devices use a little hand held button that transmits at around 433 MHz and Lo and Behold you can record the radio signal that turns the outlet on and off and transmit it through a Raspberry Pi with software called RPITX.
Allow me to translate: The network can crash all it wants. The RADIO SIGNAL you transmit from a Raspberry Pi won’t crash. There is no on and off button on a Raspberry Pi. If the power goes out the Pi will boot when the power is restored.
So I made a blog about how to record the signal and make .iq files to turn the light on and off by issuing a command in the terminal on the Raspberry Pi which you can see here. Now I’ll discuss how to use those files to do something useful. First of all I’ll just plug a simple lamp into the outlet.
I have two files called “turnonoutlet.iq” and “turnoffoutlet.iq”. So now lets have the lamp turn on at 11PM and turn off at 5AM (bear in mind you could turn it on and off whenever you want or repeatedly during the night). Let’s just keep it simple for now. The files reside in the rpitx directory.
Now lets make two script files to turn the outlet on and then off. On first.
sudo nano outlet.sh
Paste in the following (depending on the location of your files):
#!/bin/sh sudo /home/pi/rpitx/./sendiq -s 250000 -f 433.9200e6 -t u8 -i /home/pi/rpitx/turnonoutlet.iq
Now make it executable
sudo chmod +x outlet.sh
Now lets do the turn off file.
sudo nano outletoff.sh
Paste in the following:
#!/bin/sh sudo /home/pi/rpitx/./sendiq -s 250000 -f 433.9200e6 -t u8 -i /home/pi/rpitx/turnoffoutlet.iq
Make it executable.
sudo chmod +x outletoff.sh
Almost done! You can test the files by issuing the commands:
/home/pi/rpitx/outlet.sh /home/pi/rpitx/outletoff.sh
It should work like a champ. Now lets set a cron up to turn them on at 11 PM and turn them off at 5AM
Set the cron job:
crontab -e
Now paste in the following:
0 23 * * * /home/pi/rpitx/outlet.sh 0 5 * * * /home/pi/rpitx/outletoff.sh
Hit Ctl key + x then Y to save and Bob is your Uncle. Looks like this:
Wow! Yer doing it. The first cron example is minutes (0), hours (23), three asterisks is everyday basically and then it runs the script file.
This will work irrespective of whether your network is up or not!
I feel like it is a great idea to supplement home automation with RADIO CONTROLLED redundancy.