Prototype wrapup #33
Last time I finished up my art project prototypes, so this week I did something a bit more practical: home automation! I have some 433MHz radio-controlled power switches that I've been using, and I'd been planning for ages to use a cheap 433 transmitter/receiver pair with a Raspberry Pi to automate them.
Wednesday
The first step was to figure out something that would work. This took way longer than I thought. Partly, this was because my switches used values most libraries couldn't handle, and partly it was because a lot of the libraries for this stuff are really rough around the edges. Nonetheless, I managed to figure out my switch codes and set them up with this node library. This prototype was just a commandline tool, but it did the job and I could switch my lights from the Pi.
Thursday
The next step was to make something easy to interface with. I didn't want to ssh to the pi every time I wanted turn my lights on, so I built a little web server to accept POST requests. I also added support for switching multiple things at once, and queueing the commands with enough delay to avoid putting out garbled unrecognisable signals. Once I had that going I just used a little shell script to curl the appropriate commands at the Pi and now I can switch the lights from my computer. Victory!