Amazon Echo Hub

Has anyone tried using this new node?

https://flows.nodered.org/node/node-red-contrib-amazon-echo

I've not managed to get it to work with Echo Dot Gen-2 and NR running on Raspian Stretch on a RPi-3+

Would be interesting to hear from anyone who has been successful with it.

1 Like

Worked fine for me, running NR on my mac
I ran discovery from from 2nd Gen Echo Show, but I can't be sure that was the device performing local discovery as I have pretty much every kind of echo on the account/network.

What port number did you use in the properties tab on the Amazon Echo Hub ??

80, although then you'll need to start node red as root/sudo as you're accessing a privileged port (<1024)

Thanks for your response.
I've read on this forum that running NR as root is not recommended - so I've avoided it.
The port-address for the node has been made user-configurable, so I assume there is a port above1023 that Amazon Echo Dot Gen-2 listens on?

I'm not massively familiar with it but I think what this node is doing is replicating the way an echo connects to a phillips hue bridge, eg over the local network, all other smart home skills on alexa are cloud-cloud hue is the only LAN based service.
So the Amazon Echo node is making your NR look like a Hue Bridge that the echo can then discover and connect to.
It see from the code that the node uses the SSDP protocol to announce the port that the server is running on, and then it listens on that port for requests from the Echo to your Nodes, I expect that (at least some) of the echo devices will only connect to the server on port 80 as it was only ever designed to work with the hue's proprietary protocol and this is a bit of a hack (although quite a nice one!)
If you have a scan through the code https://github.com/datech/node-red-contrib-amazon-echo/blob/master/index.js you'll see various references to hue and what looks like a hard coded username which is presumably all reverse engineered from the hue stuff, A lot of this stuff was done in https://github.com/bwssytems/ha-bridge to allow people to create their own hue clone devices for Alexa to use.

In summary its not a case of finding a port that the Echo will listen on its a case of Node Red listening on a port that the Echo will connect TO

Hi Sam,
Thanks for your very detailed explanation which makes complete sense.

Cheers from David.

I've been using it on port 8980 successfully for some time now with Generation 3 dot, to turn stuff on and off by MQTT (with a debug out of the device node to make sure it is working). Can't use port 80 as that is used elsewhere. Just today it has stopped working. NO idea why at this point. I'm running this on a Pi3 with Raspbian Buster (used to run on Stretch).

On my new Pi4, I tried this out using port 8980 but it wasn't found as a device

So I stopped node-red - re-launched it as sudo node-red - had to re-add the node-red-contrib-amazon-echo using palette manager and it was discovered 1st time and responded to on/off commands :slight_smile:

I'll have to check it out and see if its more flexible than node-red-contrib-alexa-home-skill which is my current Alexa node-RED solution

What sort/version of Echo Dot are you using?

I gave up trying to get my Amazon Echo Dot Gen-2 to work with it.

I'm using a ÂŁ80 ,full size Alexa Echo bought 3 months ago - no info on it to say what version it is - it won't tell me what version it is - nothing the app to say what version it is

Uninstalled, reinstalled, works a treat, no idea what was wrong.

What led you to using this port?

Any random port above 1000 essentially as I needed port 80 for something else. SO, then a slight mod to the Pi as here (Feb 2019 update) - https://tech.scargill.net/the-script/ and it all worked – until it didn’t – then it did again. All is well.

1 Like

image

That explains why it didn't work on mine :slight_smile:
Will try that out - looks like a nice workaround to get Node-RED to use low ports without running as root :slight_smile:

1 Like

Needed a slight modification as my Pi is using WiFi but working now without having to run Node-RED as root :slight_smile:

wlan0 instead of eth0

sudo apt-get install iptables-persistent
sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
sudo iptables -A PREROUTING -t nat -i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 8980
sudo netfilter-persistent save
sudo netfilter-persistent reload

4 Likes

Just implemented the above mods on an old Raspberry Pi-1 running Stretch and NR v1.0.0-beta.2 and can confirm the Amazon Echo Hub works really well with an Amazon Echo Dot (2nd Generation).

Thanks for sharing the sudo commands.

1 Like

This discovery is going make one of my IoT students so happy (when he/they return to school in September).
He was given an Echo Dot (Gen 3) as a Christmas present and brought it to the IoT Club but we couldn't get it to work with the Amazon Echo Hub because of the Port 80 issue.

The above 'sudo commands' will fix that problem - like it did with my Echo Dot (Gen 2).

Can't wait to see the smile on his face in September.

2 Likes

[UPDATED to handle % from 0 to 100]

Just been playing around seeing if I could extract more info but all I've managed to do is get it to output msg.percentage

But at least that gives a easy number to use downstream

node-red/node_modules/node-red-contrib-amazon-echo/index.js

function payloadHandler(hubNode, deviceId) {

  var msg = getDeviceAttributes(deviceId, hubNode.context());
  msg.rgb = colorSHB2RGB(msg.hue, msg.sat, 254);
  var percentArray = ["1","26","52","77","102","128","153","178","203","229","254"];
  var percentArray = [1,4,6,9,11,14,16,19,21,24,26,29,31,34,36,39,41,44,47,49,52,54,47,59,62,64,67,69,72,74,77,79,82,84,87,90,92,95,97,100,102,105,107,110,112,115,117,120,122,125,128,130,133,135,138,140,143,145,148,150,153,155,158,160,163,165,168,171,173,176,178,181,183,186,188,191,193,196,198,201,203,206,208,211,214,216,219,221,224,226,229,231,234,236,239,241,244,246,249,251,254];
  msg.percentage = percentArray.indexOf(msg.bri);
  msg.payload = msg.on ? "on" : "off";
  msg.deviceid = deviceId;
  msg.topic = "";

  hubNode.send(msg);
}

Same here!