Node-RED google home integration


#1

Hi all,

I am in the process of writing a node-red google home integration service. https://developers.google.com/actions/smarthome/guides/

Something were you can add nodes (light/switch/thermostat/etc.) that appear in your google home application and integrate with the assistant. Similar to how the dashboard works, if you would add a light node, a new light would appear in your linked google home application.
So when you would ask google to turn on the lights or make the room warmer, etc., the node(s) in node-red will emit new values and so forth.
However, because the service needs a permanent connection with each node-red client, I would have to pay hosting for it, so after a free trial I was thinking of ~ 2$/month per user...

Would this be of interest?


[ANNOUNCE] Node-red-contrib-deepspeech Test results
#2

not to me.


#3

The idea is interesting & the price may be good.

But personally, I wouldn't want an external service to be involved with my home automation system so I wouldn't use it I'm afraid.


#4

Sorry Andrei, I would not use it, for the same reasons as the post above.


[ANNOUNCE] Node-red-contrib-deepspeech Test results
#5

I have interest. While I try to keep everything local, with Google Home (or Alexa or Cortana), you've got no choice. I'm currently using Google Home -> IFTTT -> Node-Red on Bluemix -> MQTT -> Node-Red at home. When this works, it works well and without too much lag. However, Bluemix only stays up for a few days and then crashes for a couple, so it has been a big disappointment. I plan on replacing it with another Node-Red instance at home in a DMZ, so a component like this could also cut out IFTTT, and maybe even the second Node-Red instance itself.

I'm using Node-Red as a Home Assistant add-on. There is a Google Home add-on there (https://www.home-assistant.io/components/google_assistant/), but I couldn't get it working in my environment. I think the problem was related to either Docker and/or VirtualBox and all the virtual networks involved. It also requires external access to my Home Assistant, and I don't really want to bother with the risks. Exposing just Node-Red is a much smaller attack surface, particularly if it's a port dedicated to this capability.

Some of the benefits of IFTTT that I would not want to lose are:

  • The flexibility with lots of different phrases for the same thing (eg. change the lounge lights to 50%, make the lights 50%, turn the lights on to 50%)
  • Phrases that do a number of actions (eg. I'm going to bed). This should be a no-brainer with a Node-Red component.
  • It's incredibly easy to set up. I had a bit of a play with setting up a Google Project, and it was a pain, so I gave up.

#6

Yeah, well the idea is for integration and while I also don't like 3rd party services, I think google is here to stay and I really like to say "Ok google, make the room warmer", and everything just works, like magic. :slight_smile:

OK, so there is some interest. Unfortunately not enough yet to justify the effort.

@michaelblight

  • The google home actions have lots of flexibility in the way you spell the commands. You can also say "make the room brighter", "turn on all the lights", "turn off the kitchen lights", etc. They also released a new google home hub that allows both visual and conversation interaction:
  • I guess this can be integrated with scenes https://developers.google.com/actions/smarthome/traits/scene so that you can do whatever you want when a scene gets activated
  • The way I thought of it, should be as easy as selecting google home, add devices, select node red home automation provider, enter your user and password. In node-red, you would just set the access token you get when signing up, in some configuration node.

#7

The idea is great but I also don't like to trust a server which I don't know.
The easiest way should be a solution how we can pull an URL locally with a Google assistant like Google home.
Then it's easy.
I played a few times with Google actions butt it's not easy to get a reaction into the local Network without hardware inside home and inside the private network without open port etc


#8

Wouldn't you be able to do this and deliver it as a Docker Container (for instance) - this then means updates are easy if done correctly and each person would control their own system and could run it at home or on a Hosted environment of their choice ?

You could then have a subscription fee for the updates etc but would not have to hassle with purchasing a hosted server

Craig


#9

I use HomeAutio.Mqtt.GoogleHome (https://github.com/i8beef/HomeAutio.Mqtt.GoogleHome) which is running in docker which Google Home can interface with 'directly'.
It integrates with MQTT, not with NodeRed but is simple to use via NodeRed.
It's not easy to set up, but works brilliantly once its up and running.


#10

Well, it can be made entirely as a node red plugin, so no need for docker but that would mean exposing it to the internet, a domain, a signed certificate, setting up a Google home action, etc. I was thinking to do something as painless as possible...


#11

Thats the point of doing it in docker - you provide the docker compose file - it can pull down a couple of Images, Nginx, Letsencrypt etc and can script whatever customisation is required.

Craig


#12

It's not easy to set up, but works brilliantly once its up and running.

Just a heads up, if you happen to be good at writing documentation or have suggestions on how to improve what I have, etc. I welcome that. The process is a little inherently complicated, but Google doesn't do us many favors with the complexity of their solution... and I admittedly am not the best at documentation :slight_smile:


#13

If anyone is up to it, you can give this one a try:

 https://www.npmjs.com/package/node-red-contrib-google-smarthome

/michael


#14

I created a first alpha version for integration (https://www.npmjs.com/package/node-red-contrib-nora). For now only a switch node is available, more coming soon (light, outlet, thermostat, etc.). It's very similar to the dashboard switch. The backend service is not open source (yet...?) and is hosted on a free heroku dyno in the Europe region.

If anyone wants to test it, send me a private message to provide a user/pass (I will also need the email address you use with your google home, in order to add you to the google action test users since it's not published yet).

The process is pretty simple:

  1. go to https://node-red-google-home.herokuapp.com/ and login
  2. copy the access token
  3. go to node-red and install node-red-contrib-nora
  4. create a nora-config node with the access token you just copied
  5. add the switch nodes and deploy the flow
  6. go to google home and link the account (add/setup device/have something set up/select NORA/enter user-pass)

Steps 1,2,3,6 - need to be done only once. Make sure you have some nodes before linking the accounts.

When the nodes change, they automatically get synced (including request sync to google https://developers.google.com/actions/smarthome/request-sync) so they should automatically update in your Google Home app. Report state is also implemented (https://developers.google.com/actions/smarthome/report-state) so the latency should be small enough. The data between node-red and nora is passed via socket.io (websocket ideally). Once the connection is closed, Google Home is informed that all the last known devices went offline.

Keep in mind this is a very early version so it might be unstable in some situations. Also it's hosted on a free dyno and it has a limited number of up time hours in a month and maybe some other limitations.

Once it's stable enough, I will upgrade it to a hobby dyno and leave it for free to everyone (what registration methods do you prefer?).


Google Home integration
#15

I would love to try this out but I'm unable to find how to send private messages?


#16

Click on Andreis icon above (hopefully gives you a message link)


#17

That's the thing. I don't see anything. Maybe I haven't been active enough to be trusted with PM capabilities.


#18

I did send you a message, did you receive it?
image


#19

I did, thanks. But I still seem unable to initiate a new PM thread myself.


#20

Got this working now after a few trips & falls!
To expand upon para 6, I found that the following worked well for me;

  1. Open the Google Home app Google Home app.
  2. In the bottom right corner of the Home screen, tap Account .
  3. Make sure that the Google Account listed is the one linked to your device. To switch accounts, click the down arrow .
  4. Tap Settings .
  5. Tap ASSISTANT tab and then Home Control.
  6. To add Nora, Tap + in the bottom right corner, and search/select [test]NORA

Paul