Linking Vera devices to alexa, via node-red

Ok here is a short flow that will link vera devices to alexa.
The device number and type are set in the topic of the devices as in example.
there is a dimming example, switchpower example and a scene example.
You will need to add your ip in the http request node.

You will need Node-red server and the node-red-contrib-amazon-echo node installed.

So far this has been very responsive with speech to switch in under a second.

I will add more switch types later.

edit/ Scene added you can set 1 or 2 scene numbers. eg. 123#sceneon/off wiil run scene 123.123#scene#124` on will eun scene 123, off will run 124.

Rgb switch added on/off, dimming, colour and colour temp.

1 Like

I wonder if there is a node for Google Home to make it locally integrated with Vera.

I’ve only used HA Bridge. That did work in the past with Google Home but no longer.

Still works with Alexa though.

there is promise of local control here

and docs here

You may need to enable https for google home.


I was able to get the flow imported and can turn on/off/dim lights. Is there any way to use this to run a scene from the Vera?


How does the Alexa see the devices exposed by the node-red-contrib-amazon-echo?

Presumably its acting as an emulated Philips Hue Bridge like the Java HA-Bridge does?

Yes. They show up as Hue bridge devices and are discovered by the Echo via the UPNP discovery process. It seems like I should be able trigger a Scene. I just need a function node that maps the Echo node message into a properly formatted http request to the Vera. I see how it’s being done in the example with switches and dimmers, but I’m still learning js so any help would be appreciated. Thanks!

Here is a HTTP command for a Vera scene.

Change the scene number 101 to your scene number


I was able to figure out what a properly formatted HTTP message to trigger a scene looks like by using the “VERA-IP:3840/data_request?id=invoke” command. My problem is the Function code to produce the correct output to send to the http request node. I’m looking at the example, and I have a lot of programming background, just not in js. I’m trying to figure out what everything means in there

I don’t know I’ve never used node-red-contrib-amazon-echo.

In the Java HA Bridge you just enter the regular http command to run a Vera scene.

@ElCid will know when he replies.

ok have up dated
there is a change in the topic value, it simpler just a device/scene number and a type i.e 45#scene examples in the 3 devices

[{"id":"1ae57eb8.ec60f1","type":"amazon-echo-device","z":"8659fc6b.981b4","name":"garden","topic":"53#scene","x":390,"y":960,"wires":[["9b5a41e0.3e3318"]]},{"id":"de7838ac.ebead","type":"amazon-echo-hub","z":"8659fc6b.981b4","port":"8980","processinput":"0","discovery":true,"x":150,"y":860,"wires":[["92daf72c.e52e9","4d566251.fb0fd4","6e25f043.b7a9e8","58f400e1.ad34a8","8c4e3afb.aeadd8","c9ec9262.5a9e1","1e62d298.99d4a5","d784f9e0.488ae8","d04ab3c9.7d4f28","54787300.07eb24","fe079d0f.53e5f","a2ab34f0.dd5398","92356011.33636","21ca89ff.b0f6ce","cd0ae070.e98378","f46b27d2.3bf7e","9e41f76e.b159a8","b488239e.ca86a8","d2e4083f.3b7f58","d184e8ac.29afd","563fa9e2.8119e","518251b1.190bd","fc62103c.548cb8","c5cb5526.2132d","24497419.df043c","81ffa6fb.83fe88","4f6fc1c7.c82b7","4b998977.d607d8","6340c6bf.776fd8","1ae57eb8.ec60f1"]]},{"id":"21ca89ff.b0f6ce","type":"amazon-echo-device","z":"8659fc6b.981b4","name":"app safe","topic":"164#binary","x":390,"y":1020,"wires":[["9b5a41e0.3e3318"]]},{"id":"cd0ae070.e98378","type":"amazon-echo-device","z":"8659fc6b.981b4","name":"lounge 1","topic":"8#dimming","x":390,"y":1060,"wires":[["9b5a41e0.3e3318"]]},{"id":"9b5a41e0.3e3318","type":"function","z":"8659fc6b.981b4","name":"","func":"let types = {\n    \"dimming\":[\"urn:upnp-org:serviceId:Dimming1\",\"SetLoadLevelTarget\",\"newLoadlevelTarget\"],\n    \"binary\":[\"urn:upnp-org:serviceId:SwitchPower1\",\"SetTarget\",\"newTargetValue\"],\n    \"scene\":[\"urn:micasaverde-com:serviceId:HomeAutomationGateway1\",\"RunScene\",\"SceneNum\"]\n}\n\nmsg.topic = msg.topic.split(\"#\");\nmsg.hold = msg.payload;\nmsg.payload = {};\nlet type = types[msg.topic[1].trim()];\ = \"action\";\nmsg.payload.serviceId = type[0];\nmsg.payload.action = type[1];\nif(msg.topic[1] !== \"scene\"){\n    msg.payload.DeviceNum = msg.topic[0].trim();\n    msg.payload[type[2]] = (msg.hold === \"on\" ? (type[1] === \"SetTarget\" ? 1 : msg.percentage) : 0)\n}else{\nmsg.payload[type[2]] = msg.topic[0].trim();\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":570,"y":1020,"wires":[["ab7c2ed0.91fd78","680d28ae.8a163"]]},{"id":"680d28ae.8a163","type":"http request","z":"8659fc6b.981b4","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":760,"y":1020,"wires":[[]]}]

Ok, thanks! I tried to set up ha-bridge via a Docker instance on my Qnap, but I couldn’t get it to work. When I configured the devices, most of the time the Echo wouldn’t see them after a discovery. If I could Echo to see them, any changes made wouldn’t be discovered again. I eventually gave up and switched to Nodered

Awesome! Thanks! That should be all I need to get everything working! The Topic’s are much simpler and the heavy lifting is done by the Function. Great job!

i might add a turn on and off to scenes so you can set 2 scene numbers, i.e run one when you say turn on and one when you say turn off. What do you think?

Hmmm…I personally don’t use scenes that way. I’d just have two different scenes and call them each something different, but it may be of use to someone else. You’d just have to add something to the Topic to say it’s a binary scene as opposed to just run it.

123#scene binary
123#scene#124 on off scene

Yep, that would work just great!

here is new function with scene on and off.

[{"id":"9b5a41e0.3e3318","type":"function","z":"8659fc6b.981b4","name":"","func":"let type = {\n    \"dimming\":[\"urn:upnp-org:serviceId:Dimming1\",\"SetLoadLevelTarget\",\"newLoadlevelTarget\"],\n    \"binary\":[\"urn:upnp-org:serviceId:SwitchPower1\",\"SetTarget\",\"newTargetValue\"],\n    \"scene\":[\"urn:micasaverde-com:serviceId:HomeAutomationGateway1\",\"RunScene\",\"SceneNum\"]\n}\n\nmsg.topic = msg.topic.split(\"#\");\nmsg.hold = msg.payload;\nmsg.payload = {};\ntype = type[msg.topic[1].trim()];\ = \"action\";\nmsg.payload.serviceId = type[0];\nmsg.payload.action = type[1];\nif(msg.topic[1] !== \"scene\"){\n    msg.payload.DeviceNum = msg.topic[0].trim();\n    msg.payload[type[2]] = (msg.hold === \"on\" ? (type[1] === \"SetTarget\" ? 1 : msg.percentage) : 0)\n}else{\nmsg.payload[type[2]] = (msg.hold === \"on\" ? msg.topic[0].trim() : (msg.topic[2] || msg.topic[0]).trim());\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":570,"y":1020,"wires":[["ab7c2ed0.91fd78","680d28ae.8a163"]]}]

Seems to be working just great! Thanks so much! This really seems to be the way to go to make the Echo/Vera integration bulletproof. I was getting the “…hub is not responding” message about 50% of the time

The speed rocks to.

1 Like

Oh yeah! Probably sub 1 second responses is what I’m seeing.