Node-RED google home integration


#21

I need to setup a short tutorial in the readme for future references.
You can link it directly from the main screen of Google Home (needs to happen only once, when you change devices in node-red it will automatically resync with google home if accounts still linked):

  1. go to google home and click Add

  2. select Set up device

  3. select Have something already set up?

  4. select NORA (in my case it's already linked) and enter your user/pass


#22

In the node properties, there is a 'Room Hint' field, what does that do?
Is it just a static label that serves no purpose other to remind the user where that node performs actions?


#23

The room hint is forwarded to google home. It uses it to assign the devices to rooms. Otherwise you will need to manually assign them in google home and in case of unlink/link account again, that information is lost.


#24

Andrei, it would be great if you could update the readme/node info, even if it's just rough basic notes.
You have just published v0.0.11, but if you want us to alpha test, we need some basic information what you have added.
The readme can always be updated once you're happy with the result.


#25

I focused on adding more functionality. I will also update the info when I get some more time.


#26

I just published v0.0.12 and updated the documentation for the nodes.
There is support for: outlet, switch, light (both binary and brightness control) and scene.
I also plan on adding support for light color control and thermostats.
Do you want any other device support?


#28

Published v0.0.13
Minor change, showing the current state of the node (on/off, brightness).
There's also progress on making the action publicly available and on external service registration (via GitHub/Google/Facebook).


#29

This is a really great poor video review of Andrei's NORA node :wink:
Hopefully it shows how easy it is to control Google Home connected IoT devices, without the big learning curve.
I'm hoping that Andrei will make the backend open source, so that we can follow this model....


Ways to control Node-RED with speech commands
#30

Thanks for sharing the video.

Even if I make the backend opensource, it still needs a lot of configuration to setup and you still need to host it somewhere public (right now I host it on a heroku hobby dyno so that it never sleeps). I'm also in talks with Google to allow the action public somehow (so there's no need to add people as test users in the Nora action) without me being a comercial partner. It seems they made an exception for OpenHab (based on the numer of users) and they are also willing to make an exception for us.
So once everything is done, you just register on the NORA site (with Github/Google/Facebook) and follow what you did in your video.

If by "follow the model" you want to host it yourself, there already is https://www.npmjs.com/package/node-red-contrib-google-smarthome . Even with my code you still need to do the same steps (actually more, since you need to also generate a private access key for report state / request sync), defining an action, hosting it publicly, SSL, tokens, access keys, etc.

Keeping it simple to use implies it's hosted externally so you don't have to go through all that trouble.

My process of thought is that if enough users would use it, maybe someone would donate and I would cover the hosting costs and some of my time. Either way, $7 a month it's not that much and I'm happy to cover the costs since it's very useful for me (and it should be enough for at least some couple hundred of users).

However, if the trust is the issue, maybe I can make someone from node-red a contributor... Or arrange to transfer the ownership. Not sure if they're interested in providing this as a service (for free).


#31

Breaking Change

I enabled Github/Google account login on NORA. So no more need for account creation, everyone is free to join.
However, I still need to add the gmail addresses to the action test users list (if anybody else wants to join).
For the existing test users, please login with one of GitHub/Google and get the token again.

You also need to unlink/link again the Nora service in the Google Home app.

This is only needed now for this transition to firebase auth, so won't be needed in the future anymore.
Let me know if you want other providers (Facebook/Twitter/Phone number/Email-pass) etc.

And sorry for any inconvenience :slight_smile: but this should hopefully make it easier to use the service


#32

Just trying to get my head around the Nora 'scene' node, which in it's most basic form seems pretty useful to initiate node-RED flows.

"Hey google, activate my flow"

...and the Nora scene node acts like a pushbutton and injects into whatever flow I've written.

nora

This operates differently to the Nora 'switch', because the 'scene' node can be activated numerous times in succession, whilst the Nora 'switch' will only change state.

(An option in the node is to allow deactivate 'my flow' as well, which... well I'm sure you know!)


#33

Each node has a link to the google refs for better documentation. For example the link for the Scene.

Google Home also supports setting up and adding custom Routines. So when you say something, a series of actions should happen.

For example when I say Hey google, I'm leaving all the lights should be turned off. In the future, the thermostats will be set to a lower temp. And if you have scenes defined, you can also adjust the scenes.


#34

If you could add locks as well that would be great!!

Thanks for all the hard work on this. Happy to contribute to help cover the cost of an upgraded dyno account to get 24x7 availability if you want to post a Venmo or PayPal link.


#35

Thanks!
The donate link is on the github repo in a badge. I'll probably add it on the NORA page as well for better visibility.

As for the lock, it seems google smart home doesn't support locks yet (or at least it's not documented).
Here is a list of devices that are documented: Smart Home Device Types


#36

Sounds good, will send some $'s your way.

On my HomeSeer Google Home integration it seems a bit mixed. They show up as locks but I can't control them through the screen, just with voice commands. They must still be working on it. I can use switches in the short run and will help keep an eye out for when they open them up


#37

So starting to test and still trying to figure out the best way to integrate with my MQTT instance.

So first potential bug report. I setup a node for a dimmer light with a topic representing my MQTT set topic.

I enabled "save/receive as complete state" With the light on, when I change the dim level inside Google Home I get the following error: TypeError: Cannot use 'in' operator to search for 'brightness' in 63

Then if I turn off "save/receive as complete state" now my output object isn't changing the payload when I change the dim level of the light inside Google Home (left the light on since last step).

Now if I turn off the light from Google Home and turn it back on, it turns on at the right dim level and I can now adjust the level and it comes through. Though I notice if I cycle it off/on/off it is sending a brightness of 100 vs. the brightness I see on Google Home.

Now if I turn back on "save/receive as complete state" when I turn the light on/off inside Google Home it turns on with 100 dim factor vs the dim level I see on Google Home (and retains brightness: 100 in on or off mode. If I adjust the dim level I get the same error as above.

Let me know any other information I can provide to help troubleshoot

Edit: the 100 on vs the set brightness seems to be related to the MQTT connections. I have an input and output both connected. If I delete the output from the NODA node to MQTT (leaving in place the input from M!TT to NODA) then it cycles to/from the dim level. If I reconnect it to the MQTT on both output and input to the NODA node it cycles to/from 100. Same if I delete the input to NODA from MQTT that it goes back to the 100 cycle vs the dim level.

Let me know if you need me to break apart these issues and provide more details to them.


#38

So if you check Send/receive complete state as payload, the node will expect on the input and will send on the output on the state change, a message in the format:

{
  payload: {
    on: true/false,
    brightness: 0-100, 
  }
}

You can also send only on or only brightness.

If the checkbox is unchecked it will expect and send, a number (0 - 100). The catch is that the value 0 translates into brightness: 100, on: false so that the next time you want to turn on the light from google it will turn at full brightness. That's because I have lights on the hallway that turn at 20% when presence is detected and the light is low, but if I ask google to turn them on, I want them full on. Maybe I should add another checkbox for this, but you can always use the Send full state checkbox and translate numbers into state however you want.

Also, I noticed Google Home doesn't update the light state while you have the light open in the app. You need to go back and select the light again.


#39

[quote="andrei-tatar, post:38, topic:4829"]
The catch is that the value 0 translates into brightness: 100, on: false so that the next time you want to turn on the light from google it will turn at full brightness. That's because I have lights on the hallway that turn at 20% when presence is detected and the light is low, but if I ask google to turn them on, I want them full on. Maybe I should add another checkbox for this,

I think either a check box to determine if lights turn on at previous brightness or 100 would be helpful or my suggestion would be to let them turn on at previous by default with the option to override through the input on the node. That way you can handle your 20% or 100% cases through your flows and not inside the node. [/quote]

I do something similar based on time of day for lights (like my bathroom) where if node-red detects an on for those lights I then send the dim value to the light to adjust for the current time of day (only slight lag from when they turn on).

I did set that up in testing but wanted to avoid having to add an extra subflows (one for input one for output) on each NORA node.


#40

Ok, created an issue on github https://github.com/andrei-tatar/node-red-contrib-nora/issues/6
Either way, the node default is to send/expect a state object.


#41

Just published 0.0.15

This new version brings the fix for the light node (with custom override) and a new feature: up to 3 concurrent node-red connections for the same user (based on the group string - available in nora config node). This allows multiple instances of node-red to sync devices in one google home.

This also paves the way to the possibility of connecting physical devices (ESP8266) directly to your google home (via a web socket connection). Not sure if anyone is interested in this.