Return to Tricks with Google Home

Garage Door Minder – IFTTT interface

Goal here was to connect my Google Home to the Particle Photon Garage Door minder.  Can you say “Ok Google, Open the Garage Door”….

Several pieces make this come together.  First the Google Assistant Service on allows you to process OK Google commands and then take action on them.  Second, there’s a Particle service for that allows you to call Particle cloud functions, take actions on Particle cloud events, etc.

So a simply “Applet” in IFTTT has to say :

If the google assistant hears “Open the Garage Door“, then call the Particle cloud function DoorOpen()

Easy as that,  then simply add the converse to close the door and we’re done!

Ok, yeah, a little harder than that as I had to go back to the Photon software to write and publish a DoorOpen and DoorClose function which I didn’t have before, but was really only a handful of addition lines on the photon

In setup()

 Particle.function(“CloseButton”, CloseButton);
 Particle.function(“OpenButton”, OpenButton);

then in loop()

// Function called to press the door button
// hold the button for 1/2 second
int PushButton(String s){
    digitalWrite(DoorButtonPin,1);  // press the button
    digitalWrite(DoorButtonPin,0); // release the button

// function to open the door, that is press the button
// but only if the door is currently closed
int OpenButton(String s){
    if( Door == DoorClosed)PushButton(s);

// function to close the door, that is press the button
// but only if the door is currently open
int CloseButton(String s){
    if( Door == DoorOpen)PushButton(s);