Node-RED google home integration

With NodeRED you can "ping" devices in the network. If you get a "false" answer, the device is off, right? Please ignore or improve if this is wrong ...

There is definitely a ping node, and I tried that approach but unfortunately wasn't successful. It's probably possible and I likely borked the config in some way. If the approach I'm going for now doesn't happen to work I'll circle back to it.

Starting to get the hang of this now

Now it doesn't matter whether the TV is turned on by physical remote or by Google, I'll be able to turn it on or off regardless at all times since Nora will always be in sync. All I had to do was pass that "playing" state to the switch and direct accordingly. The same tactic worked for my Fire TV.

@andrei-tatar I was setting up some virtual switches to control a group of lights and realized the on a light node only takes 0-100 and won't accept On/Off if "Allow Brightness Control" is checked and "Send/receive complete state" is not checked. Is this by design or a bug?

Isn't 0 = Off?

Yes it is. It was more that I got confused between complete state vs non-complete and if you could send/receive an explicit off/on command. In retrospect the switch is working as designed of sending/receiving raw brightness #'s with the "Send/receive complete state" off.

My mistake.

1 Like

Just sharing.

For anyone who is using lights that use 0,255,brightness as the inputs/outputs and want to use "Send/receive complete state" set to on, here are subflows I put together to convert between a complete state object and a 0,255,brightness level depending on if Off/On/Change in Brightness is received from NORA (or vice versa on the input).

Here is a post-NORA node (Note: my interface to HomeSeer requires strings so if you need numbers you might need to make a change to the change nodes to use numbers and not strings) :

[{"id":"d6132d2d.a892c","type":"subflow","name":"NORA - Post","info":"","category":"","in":[{"x":80,"y":180,"wires":[{"id":"116868a0.ec08b7"}]}],"out":[{"x":780,"y":180,"wires":[{"id":"19aaafe8.1c9cc","port":0},{"id":"2af74ff0.26cc9","port":0},{"id":"4f2a09b0.731858","port":0}]}]},{"id":"116868a0.ec08b7","type":"switch","z":"d6132d2d.a892c","name":"On/Off","property":"payload.on","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":180,"wires":[["faafcfc6.f2528"],["4f2a09b0.731858"]]},{"id":"4f2a09b0.731858","type":"change","z":"d6132d2d.a892c","name":"Off","rules":[{"t":"set","p":"onPrevious","pt":"flow","to":"payload.on","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":220,"wires":[[]]},{"id":"faafcfc6.f2528","type":"switch","z":"d6132d2d.a892c","name":"onPrevious","property":"onPrevious","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":160,"wires":[["19aaafe8.1c9cc"],["2af74ff0.26cc9"]]},{"id":"2af74ff0.26cc9","type":"change","z":"d6132d2d.a892c","name":"Last","rules":[{"t":"set","p":"onPrevious","pt":"flow","to":"payload.on","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"255","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":180,"wires":[[]]},{"id":"19aaafe8.1c9cc","type":"change","z":"d6132d2d.a892c","name":"Brightness","rules":[{"t":"set","p":"onPrevious","pt":"flow","to":"payload.on","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.brightness","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":140,"wires":[[]]}]

Here is a pre-NORA node (Note: The function is in there to convert the string I get to a number for NORA):

image

[{"id":"6ee85fdd.12c49","type":"subflow","name":"NORA - Pre","info":"","category":"","in":[{"x":80,"y":100,"wires":[{"id":"23f7c1.3972f84"}]}],"out":[{"x":700,"y":100,"wires":[{"id":"43c4e555.32564c","port":0},{"id":"3a7f55a3.65e3da","port":0},{"id":"cc707d6c.fbe7e","port":0}]}]},{"id":"385c570d.c4a378","type":"switch","z":"6ee85fdd.12c49","name":"Status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"255","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":370,"y":100,"wires":[["43c4e555.32564c"],["3a7f55a3.65e3da"],["cc707d6c.fbe7e"]]},{"id":"43c4e555.32564c","type":"change","z":"6ee85fdd.12c49","name":"Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":60,"wires":[[]]},{"id":"3a7f55a3.65e3da","type":"change","z":"6ee85fdd.12c49","name":"On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":100,"wires":[[]]},{"id":"cc707d6c.fbe7e","type":"change","z":"6ee85fdd.12c49","name":"Brightness","rules":[{"t":"set","p":"brightnessPrevious","pt":"flow","to":"payload","tot":"msg"},{"t":"move","p":"payload","pt":"msg","to":"payload.brightness","tot":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":140,"wires":[[]]},{"id":"23f7c1.3972f84","type":"function","z":"6ee85fdd.12c49","name":"toNumber","func":"msg.payload = parseInt(msg.payload,10);\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":100,"wires":[["385c570d.c4a378"]]}]

Edit: Note that you might need to set an initial brightness from your device for the input flow to work correctly.

Edit: Updated the Pre-subnode to remove the Brightness setting for on/off status..

Hi Andrei,

Sorry - trying to PM you but can't seem to find how, are you able to add my gmail to your testers list?

Many thanks

Jonny

Hi Andrei, I would love your amazing job.
Can you add me to the testers?

Kind Regards.

Marco

Hi everyone, happy new year to all.
Andrei, can you make me a tester? I can't send you a PM.
Thanks

Hi Andrei-tatar

Seems it's not possible to PM you, can you add me to the testing crew?

My mail is my username @gmail.com

Thanks

/bloody2k

I wonder if anyone can help me - i'm now having an amazing time with Node-RED, thanks to Andrei.

I'm trying to get a switch in Google to send a TCP command. I'm clearly missing something, as sending the HEX command 02 88 00 01 1b 83 00 01 00 00 00 00 00 00 01 8a 03 in Packet Sender activates my device function however my current setup in Node-Red doesn't.
53


37

Is there a particular way to send TCP commands?

The on output seems to be set to send a string not a binary buffer

Hi Andrei, could you send me your e-mail adress because I don't know how to send you a PM.

Thanks a lot.

Best regards,

Hi
It seems new users or users with no previous posts are not allowed to PM other forum members.
I would be interested in testing NORA as well.
Please add me to the testers list.

Regards

It is perhaps an anti spamming feature for the forum.
Maybe a google form or something could be used to directly add users to the testers list, now that the userbase is expanding :slight_smile:

I guess it won't be long till NORA is publicly accessible.

1 Like

I finally came around trying this plugin but i get stuck trying to link the service to my account. I have activated Actions on Google through their console. I have logged in to Nora, retrieved my access token and pasted it in a dummy light device I set up in my node-red installation. Then, when i open the Home app I can see the [test] NORA service, I can click it and log in, then eventually it redirects back to the "Configure" page in Home. If I open the service list again, NORA is not under linked services. It's listed where I add new services. When I go back to my devices I don't see the ones I have through NORA.

Also, when I try to send something to the NORA node there's an error dialog popping up saying "node is not deployed". However, I have deployed the entire flow.

What am I doing wrong?

Make sure you have the latest node-red-contrib-nora installed and the flow is deployed. In the logs you should see something like Node-RED[318]: 3 Jan 13:30:44 - [info] nora: sync 10 devices if the devices were synced. Only after the devices are synced successfully link the service in your Google Home.

Nevermind, it seems to be I have much bigger issues with the entire node-red instance atm. I'll report back when I've figured this out.

edit/ Almost too embarrassing to even tell, but the Flow I was using was apparently in "Disabled" state so it was never deployed. Now that I've actually deployed it, Home app immediately picked up the devices, didn't have to re-link. Seems very promising so far, well done!