A Small Holiday Project

The holidays are here, and I had some spare time to make some not-so-smart outdoor lights smart with the help of a Raspberry Pi.

It’s that time of the year now. The Christmas holidays are upon us, and with that comes the bright decorations that people put up around the neighbourhood. For my family, it was no different: we also put up our lights.

In previous years, controlling these lights became less and less of a manual task. In the early days, we would open the front door to plug in the lights when dusk came, and unplugged them when we went to bed. More recently, within the last three or four years, we bought a cheap $6 outdoor plug and remote set, where you could control the plugs with the RF remote inside the house. This year, I decided to take said remote controller and hook it up to the network.

I did some hack job soldering to hook up the remote’s power supply to the one on the Pi board, and wired the push button switches to the GPIO pins, and wrote a small hacky shell script that would toggle the GPIO pins I needed to control the remote. I think the other thing I could have done was hook up the remote’s power supply to a relay, so that it wouldn’t have to keep the LED on all the time. Nonetheless, the final result was something like this:

I’m not super great with electronics, but it’s a start I guess.

Hooking it up to a Raspberry Pi took care of connecting the lights to the network. In order to control it with Google Assistant, I ended up using IFTTT (If This Then That). In order for this to work, I needed to expose an endpoint on my home server for IFTTT to connect to. In my case, I wrote a little PHP script that would execute a shell script to SSH into the Pi and run the local on/off script there. After that, I created a Google Assistant trigger that would listen for “Turn on the Christmas lights”, and got it to fire off a web request to said endpoint.

The IFTTT recipe I created.

I did the same thing for the turn off case, and it works great! I even put it on a timer, which you can also do via IFTTT, but I chose to do it with a crontab job locally on the Pi instead: saves a call from the Internet.

Anyways, that’s just a seasonal thing, will be removing it once the holidays are over, but it’s definitely nice to see all the lights lit up around the neighbourhood in these strange times.

That’s all I have today, until next time!
~Lui

Injabie3
Injabie3

Just some guy on the Internet that writes code for fun and for a living, and also collects anime figures.

Articles: 265

Feel free to leave a reply