- google-home-notifier -- created by noelportugal https://github.com/noelportugal/google-home-notifier
- php (code is below)
- IFTTT maker
First install and run google-home-notifier as instructed on his page (linked above)
I installed this on my Pi
When you start up the example.js as mentioned, it will give the following when it is ready to receive requests:
POST "text=Hello Google Home" to:
http://localhost:8080/google-home-notifier
https://*******.ngrok.io/google-home-notifier
example:
curl -X POST -d "text=Hello Google Home" https://*******.ngrok.io/google-home-notifier
For my application, I use the line referencing localhost info but changed localhost to the server it was running on since my php code is on a different box.
http://localhost:8080/google-home-notifier
to
http://ip_of_pi:8080/google-home-notifier
Next, create a php script similar to mine below:
change ip_of_pi in the code to the ip of where you installed google-home-notifier
The $url in the code was just for this write up but your should use an https connection and credentials since this is externally accessible
announce.php
$url = 'http://ip_of_pi:8080/google-home-notifier';
$post_data = "text={$_GET['sayWhat']}";
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$return = curl_exec($ch);
curl_close($ch);
Now create an IFTTT applet at https://ifttt.com/
create a New Applet
Choose + this
Choose the Google Assistant service
Choose the phrase with a text ingredient
Enter the desired phrase to kick off the request
and use $ where you want your input.
You may also choose a custom response -- including
the $ if you want the phrase repeated in the response
Now choose + that
Choose the Maker action service
web request
Enter the url where your php code can be reached (needs to be externally accessible)
{{TextField}} is the $ item received as part of the + this from aboveMethod: GET
Content Type: text/plain
Click Finish to save you new applet
If everything went well it should look like the following
Create a second js file and a second IFTTT applet for calling the 2nd (or more) room(s)
No comments:
Post a Comment