MadPatch
Posts: 9
Joined: Wed Mar 15, 2017 10:21 pm

Connecting Raspberry Pi to Google Home

Sun Jun 18, 2017 7:31 pm

I'm trying to connect my google home to my raspberry pi via IFTTT and Maker Channel, I got my google home to send a webrequest to a page. The page responds "Congratulations! You've fired the lightsoff event". Is there some way I can setup some code so if those words are displayed then the PI will do something (like trigger a relay, or run a command to a arduino to trigger a relay)

Thanks, Patrick

User avatar
topguy
Posts: 3491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Connecting Raspberry Pi to Google Home

Sun Jun 18, 2017 7:54 pm

Where is that page ? on the Pi ?
served by what ? Apache ?

Its relatively easy with Python (and Flask) or Node-red to set up something that reacts to a web-request to a specific page/path.

MadPatch
Posts: 9
Joined: Wed Mar 15, 2017 10:21 pm

Re: Connecting Raspberry Pi to Google Home

Sun Jun 18, 2017 8:07 pm

Ok, i'm very new to raspberry pi so I don't know much, but The page was created through ifttt. The URL is https://maker.ifttt.com/trigger/lightso ... G3FzkbWelW

Also if it helps I can select GET/POST requests.

If anyone knows of a code that may work with just changing a few lines that would be great! I saw this video https://www.youtube.com/watch?v=6lpLeNqOges which where I got the idea, they don't post a code, but they do talk about a python one.

Thanks

MadPatch
Posts: 9
Joined: Wed Mar 15, 2017 10:21 pm

Re: Connecting Raspberry Pi to Google Home

Mon Jun 19, 2017 11:44 pm

If anyone has an idea of what this code should look like I would very much appreciate it.

Thanks, Patrick

User avatar
topguy
Posts: 3491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Connecting Raspberry Pi to Google Home

Tue Jun 20, 2017 7:27 pm

My answer focus on node-red.. if you want a hint for python then I suggest you look at the Flask guide. ( https://www.raspberrypi.org/learning/py ... worksheet/ )
I did a fair amount of googling but couldnt really find a simple example for using the "http" input node to run a script/command.

The node-red documentaton doesn't contain much information about the different nodes either but there is a lot of information in the flow-editor itself.

This was the best I found, you should watch a video about node-red first just to understand the concept.
https://cookbook.nodered.org/http/creat ... point.html

So in my head the only thing you need to add to the simplest http example is an "exec" node that is also connected to the input node and the exec node runs whatever command you need to "turn the lights off".

MadPatch
Posts: 9
Joined: Wed Mar 15, 2017 10:21 pm

Re: Connecting Raspberry Pi to Google Home

Sat Jul 01, 2017 2:48 pm

So I have a small problem, when creating the http in node it needs a url, which can only be my ip/something, and the maker channel uses a URL which can only be makerchannel/.... So I can link the 2.

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 9 guests