Google Assistant integration with cayenne

About This Project

how about if you can control your cayenne actuator with google assistant by saying Ok cayenne, Turn on the bedroom lights.
this is a simple project that you can use and change accordingly to your own need.
the project is based on the project made by @adam Using Node-RED as a Local Fallback Server and Madhan Sundaram’s “Hey Google Turn on Front light” — set up and code | by Madhan Sundaram | Medium.
Go through both the topics and get your device ready for the project.

Important points:

  • make sure to change the node-red password Redirecting…

  • to Restart nginx use sudo service nginx restart

  • have a google account linked to IFTTT account.

The basic flow of this project:

Google Home ----> IFTTT ----> Dataplicity ----> Local RPi (Nginx)—> NodeRED ---->cayenne(node-red device)-----> trigger -----> cayenne(device to controlled) .

Follow Madhan Sundaram’s tutorial till you get msg.payload from the HTTP endpoint.
Next, follow @adam tutorial till you can subscribe and publish messages to cayenne.
Once you are done edit the node-red flow to look like this:

[{"id":"e4339793.2daab8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"efa6b635.257cc8","type":"http in","z":"e4339793.2daab8","name":"IFTTT","url":"/incoming1","method":"post","upload":true,"swaggerDoc":"","x":300,"y":200,"wires":[["f82bea64.c6eaa8","32cf3092.1d63e","d039f13b.33a94"]]},{"id":"f82bea64.c6eaa8","type":"http response","z":"e4339793.2daab8","name":"","statusCode":"","headers":{},"x":540,"y":200,"wires":[]},{"id":"32cf3092.1d63e","type":"debug","z":"e4339793.2daab8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":540,"y":280,"wires":[]},{"id":"5f85fc19.28c6b4","type":"mqtt out","z":"e4339793.2daab8","name":"Cayenne Output Channel 2","topic":"v1/username/things/clientID/data/3","qos":"0","retain":"true","broker":"c5428ca1.65f26","x":500,"y":600,"wires":[]},{"id":"7bb5c0ad.6fcdf","type":"inject","z":"e4339793.2daab8","name":"Setup","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":130,"y":380,"wires":[["75fcefd1.e8948"]]},{"id":"75fcefd1.e8948","type":"function","z":"e4339793.2daab8","name":"Set Global Variables","func":"global.set(\"username\",\"See Post\");\nglobal.set(\"clientID\",\"See Post\");\n\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":380,"wires":[["491e916a.ec494"]]},{"id":"491e916a.ec494","type":"debug","z":"e4339793.2daab8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":790,"y":380,"wires":[]},{"id":"d039f13b.33a94","type":"change","z":"e4339793.2daab8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"digital_sensor,d=1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":500,"wires":[["5f85fc19.28c6b4"]]},{"id":"c5428ca1.65f26","type":"mqtt-broker","z":"","name":"","broker":"mqtt.mydevices.com","port":"1883","clientid":"xxxxx","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


the above flow publishes a value 1 on channel 3 to create a digital sensor widget.

IFTTT screenshots:

What’s Connected

The device you want to control using google assistant

Triggers & Alerts

Trigger plays a major role in this. Set a trigger to turn ON the actuator on your arduino cayenne device whenever a value 1 is received on channel 3 on the node-red cayenne device.

Scheduling

Dashboard Screenshots

Node-red cayenne device with digital sensor widget on channel 3

Arduino cayenne device with red light actuator widget which you want to control.

Photos of the Project

(Take some pictures of your project functioning in the wild!)

Video

##Debug:
Check the run counter in IFTTT to verify that the trigger is running.
Add a debug node in the node-red to check if msg.payoad is received from HTPP endpoint.
check the cayenne trigger counter to verify the trigger is running.

5 Likes

Very nice! It’s good to see some Google Assistant integration.

1 Like

this is just the basic work flow on how to do it. users can add n number of HTTP end nodes and control anything they want.

1 Like

Hi i have problem i can not understand webhook how can i ulr and past on ifttt

follow the tutorial by Madhan Sundaram. you will find how to get the URL.

If along with these explanations and annotations a video was made from all the stages and was posted, perhaps for newcomers it would be easier to work.

Here’s an awesome deal on a Google Home Mini if anyone want’s to try this out I got a Google Home Mini for $1, and you can too: Here's how! (U.S. only)

1 Like