top of page

Raspberry PI IOT Hub



Last year after Christmas, I wrote about using the ESP8266 and Arduino to turn one of those push button remote outlet controllers into a web controlled one. While it did work, it was kind of klunky and required lots of different pieces.

This year I purchased another Raspberry Pi after my last one burnt out from a misfortunate occurrence with cheap motor driver.

And so set off to do the same thing but with a more sleek design. I wanted to be able to control the switches with Google Home, so I setup the IFTTT to send Post requests to a webserver hosted on the raspberry pi.

I have two webservers running, one to handle the requests from IFTTT and one that hosts a web page of buttons that allows you to turn on and off switches manually. I wanted it to be webbased so that it didn't matter what device you were on, all you need is a web browser.

The code for all of this is here on GitHub:

The basic principles of how the Google Home commands via IFTTT and pushing buttons on this webpage are the same. In both cases, the HTTP command of POST is being sent to the server. The Server then parses the commands and looks for two variables. lightname and state.

Then it passes it through a bunch of if statements which determine what action to take. Which in this case the Raspberry PI just toggles the GPIO pins that are tied to the buttons on the switch panel. I also wanted to be able to control my Wemo switch with the same webinterface. So in the code you will see where it sends a POST command itself, to IFTTT to toggle the Wemo switch. I would rather be able to control the Wemo switch without the use of IFTTT and started to read about how that is done, but for the time being, using IFTTT is the easiest


Comments


bottom of page