# Node-red to google assistant / Alexa

**URL:** <https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111>\
**Category:** General\
**Created:** [24 March 2021 09:31 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111 "2021-03-24T09:31:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![akszyn\_pl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akszyn_pl/32/36504_2.png) [@akszyn\_pl](https://discourse.nodered.org/u/akszyn_pl)\
**Post date:** [24 March 2021 09:31 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/1 "2021-03-24T09:31:03Z")

</div>

Hello, is it possible to use node-red to sending a command to turn on / off the device to the Google assistant or Alexa from Amazon?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 March 2021 10:58 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/2 "2021-03-24T10:58:46Z")

</div>

yes you can use alexa remote2 node to turn on smart devices or run routines. Not sure aboiut google as i do not own one.

---

<div class="post-metadata">

**Author:** ![akszyn\_pl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akszyn_pl/32/36504_2.png) [@akszyn\_pl](https://discourse.nodered.org/u/akszyn_pl)\
**Post date:** [24 March 2021 12:42 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/3 "2021-03-24T12:42:06Z")

</div>

could I ask for help how to arrange it all to send Alexa a command to control Smart devices ?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 March 2021 12:55 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/4 "2021-03-24T12:55:42Z")

</div>

simple as below  
device is the device name in alexa app  
action is turnOn/turnOff  
there is more info on actions for dimming etc in the nodes help section.

```auto
[{"id":"ed093db6.d8a2e8","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload.device","v":"lounge 1","vt":"str"},{"p":"payload.action","v":"turnOn","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":3720,"wires":[["614f4c73.8bc11c"]]},{"id":"614f4c73.8bc11c","type":"function","z":"5a245aa1.510164","name":"create json","func":"msg.payload = [{\"entity\":msg.payload.device,\n \"action\": msg.payload.action\n }\n]\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":3720,"wires":[["89d4ab46.49c03"]]},{"id":"89d4ab46.49c03","type":"alexa-remote-smarthome","z":"5a245aa1.510164","name":"Smarthome Action","account":"b0877f3.836aa","config":{"option":"action","value":[]},"outputs":1,"x":510,"y":3720,"wires":[[]]},{"id":"b0877f3.836aa","type":"alexa-remote-account","name":"alexaremote2","authMethod":"proxy","proxyOwnIp":"192.168.1.25","proxyPort":"3456","cookieFile":"alexa-remote2.txt","refreshInterval":"14","alexaServiceHost":"layla.amazon.co.uk","amazonPage":"amazon.co.uk","acceptLanguage":"en-UK","userAgent":"","useWsMqtt":"on","autoInit":"off"}]

```

the device and action is set in the inject node.

---

<div class="post-metadata">

**Author:** ![akszyn\_pl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akszyn_pl/32/36504_2.png) [@akszyn\_pl](https://discourse.nodered.org/u/akszyn_pl)\
**Post date:** [24 March 2021 13:07 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/5 "2021-03-24T13:07:11Z")

</div>

and how to configure the last node? Because I still have the inscription that the account has not been initialized

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 March 2021 13:19 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/6 "2021-03-24T13:19:28Z")

</div>

it is configure you need to feed it the json payload that the function node creates, that makes it dynamic. read the help info it's all there.

all you need to do is config the amazon sign in via proxy method and then the node will instruct you to go to [http://yourip:3456](http://yourip:3456) to sign into amazon.

 ![Screenshot_20210324-132048](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c646ecd7f41545a3db152aed2661940052bbf6d9.png)

 ![Screenshot_20210324-132102](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/776169840d5f1929e3ad5ed17a3f053dcd5078ed.png)  
The details above are for UK amazon account, more info for others in help info.

---

<div class="post-metadata">

**Author:** ![akszyn\_pl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akszyn_pl/32/36504_2.png) [@akszyn\_pl](https://discourse.nodered.org/u/akszyn_pl)\
**Post date:** [24 March 2021 13:21 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/7 "2021-03-24T13:21:35Z")

</div>

And where to get this one

> [@E1cid](#):
>
> the json payload

And how to set it up

> [@E1cid](#):
>
> config the amazon sign in

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 March 2021 13:25 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/8 "2021-03-24T13:25:35Z")

</div>

> [@akszyn\_pl](#):
>
> And where to get this one

As said the function node creates it from the info supplied in the inject node, or any other input, eg http/mqtt etc

---

<div class="post-metadata">

**Author:** ![akszyn\_pl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akszyn_pl/32/36504_2.png) [@akszyn\_pl](https://discourse.nodered.org/u/akszyn_pl)\
**Post date:** [24 March 2021 13:27 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/9 "2021-03-24T13:27:47Z")

</div>

So what else should I change?

```auto
[{"id":"4963bd5a.7f62e4","type":"inject","z":"5dcef20d.8a938c","name":"","props":[{"p":"payload.device","v":"radio fm","vt":"str"},{"p":"payload.action","v":"turnOff","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":100,"wires":[["215bc734.76f748"]]},{"id":"215bc734.76f748","type":"function","z":"5dcef20d.8a938c","name":"create json","func":"msg.payload = [{\"entity\":msg.payload.device,\n \"action\": msg.payload.action\n }\n]\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":290,"y":100,"wires":[["8e0c23cc.dacf4"]]},{"id":"8e0c23cc.dacf4","type":"alexa-remote-smarthome","z":"5dcef20d.8a938c","name":"Smarthome Action","account":"b0877f3.836aa","config":{"option":"action","value":[]},"outputs":1,"x":500,"y":100,"wires":[[]]},{"id":"b0877f3.836aa","type":"alexa-remote-account","name":"test","authMethod":"proxy","proxyOwnIp":"192.168.1.6","proxyPort":"3456","cookieFile":"","refreshInterval":"14","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.com","acceptLanguage":"en-US","userAgent":"","useWsMqtt":"on","autoInit":"off"}]

```

To test the device on or off?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 March 2021 13:52 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/10 "2021-03-24T13:52:28Z")

</div>

is radio fm a smart device ?

---

<div class="post-metadata">

**Author:** ![akszyn\_pl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/akszyn_pl/32/36504_2.png) [@akszyn\_pl](https://discourse.nodered.org/u/akszyn_pl)\
**Post date:** [24 March 2021 13:55 UTC](https://discourse.nodered.org/t/node-red-to-google-assistant-alexa/43111/11 "2021-03-24T13:55:35Z")

</div>

Yes it is a Smart device, I did it and I had to add

```auto
[{"id":"124e324b.5cd08e","type":"alexa-remote-init","z":"418c032.e1eeffc","name":"inicjalizacja alexy","account":"b0877f3.836aa","option":"initialise","x":190,"y":420,"wires":[[]]},{"id":"ffba50b9.5a9d1","type":"inject","z":"418c032.e1eeffc","name":"guzik aktywacyjny","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":360,"wires":[["124e324b.5cd08e"]]},{"id":"b0877f3.836aa","type":"alexa-remote-account","name":"alexaremote2","authMethod":"proxy","proxyOwnIp":"192.168.1.6","proxyPort":"3455","cookieFile":"","refreshInterval":"14","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.com","acceptLanguage":"en-US","userAgent":"","useWsMqtt":"on","autoInit":"off"}]

```

Scenes can also be activated in this way but how to sync device statuses with Alexa in ha?
