Setting up node-red-contrib-alexa-home

The setting exists but will remain undocumented. If you know enough to find it you can use it, that is the thinking at least.

1 Like

Got a bit further, but discovery still failed:

image

Ahhhh, I think I see what is going on now


Dec 23 19:26:12.541483 Collective-Core conmon[296448]: 23 Dec 19:26:12 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.253-6000/GET -> /alexa-home/setup.xml
Dec 23 19:27:07.625440 Collective-Core conmon[296448]: 23 Dec 19:27:07 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.242-6000/GET -> /alexa-home/setup.xml
Dec 23 19:27:07.658305 Collective-Core conmon[296448]: 23 Dec 19:27:07 - [info] [alexa-home-controller:Alexa Controller] Request data: 10.10.2.1-6000/GET -> /alexa-home/setup.xml
Dec 23 19:27:22.086760 Collective-Core conmon[296448]: 23 Dec 19:27:22 - [info] Stopping modified nodes
Dec 23 19:27:22.098316 Collective-Core conmon[296448]: 23 Dec 19:27:22 - [info] Stopped modified nodes
Dec 23 19:27:22.151230 Collective-Core conmon[296448]: 23 Dec 19:27:22 - [info] Updated flows
Dec 23 19:27:22.482784 Collective-Core conmon[296448]: 23 Dec 19:27:22 - [info] Starting modified nodes
Dec 23 19:27:22.510450 Collective-Core conmon[296448]: 23 Dec 19:27:22 - [info] Started modified nodes
Dec 23 19:27:35.335867 Collective-Core conmon[296448]: 23 Dec 19:27:35 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.15-6000/GET -> /alexa-home/setup.xml
Dec 23 19:27:35.454640 Collective-Core conmon[296448]: 23 Dec 19:27:35 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.13-6000/GET -> /alexa-home/setup.xml
Dec 23 19:27:35.544485 Collective-Core conmon[296448]: 23 Dec 19:27:35 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.7-6000/GET -> /alexa-home/setup.xml
Dec 23 19:27:35.741314 Collective-Core conmon[296448]: 23 Dec 19:27:35 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.18-6000/GET -> /alexa-home/setup.xml

It seems like it is asking a bunch of devices on my network (looking for alexa devices) on port 80, but it seems that would be redirected to 6000 because of our changes, but should be broadcasting out to the network at 80 because it got re-redirected right? Not sure how that setup.xml would come back to NR though.

change the 6000 setting in the node, but keep the environment variable. maybe that will fix it.

Interesting, those logs coincide directly with me asking her to discover devices. Not sure if that helps clear up anything.

Tried it, didnā€™t crash NR which is good, but did not seem to do much to fix it.

That didnā€™t change those messages to use port 80 instead of 6000?

No, but I will try a full redeploy and try again.

Edit: Nope, but it did seem to find my 4 echo dots properly:

Dec 23 19:37:19.906038 Collective-Core conmon[296448]: 23 Dec 19:37:19 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.13-6000/GET -> /alexa-home/setup.xml
Dec 23 19:37:19.962097 Collective-Core conmon[296448]: 23 Dec 19:37:19 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.7-6000/GET -> /alexa-home/setup.xml
Dec 23 19:37:19.980543 Collective-Core conmon[296448]: 23 Dec 19:37:19 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.15-6000/GET -> /alexa-home/setup.xml
Dec 23 19:37:20.009688 Collective-Core conmon[296448]: 23 Dec 19:37:20 - [info] [alexa-home-controller:Alexa Controller] Request data: 192.168.2.18-6000/GET -> /alexa-home/setup.xml

I wonder if that setting is only relevant for the webserver option:

This node is setting up the controller node for alexa interaction. It starts a SSDP Service on Port 1900/udp and is also able to start a seperate webserver on the configured port.
But it is also possible to use node-red as webserver and donot start a second webserver.

Be aware that alexa requires a response server running on port 80!

Yeah, unfortunately looking at the code it seems to be using the ALEXA_PORT setting for both that outgoing call as well as the incoming callsā€¦ not ideal.
Thereā€™s a way to make it possible to listen on port 80 directly without running as root though. Hang on, need to check how I have that controlled.

EDIT: Just checked, I have already set port 80 to be the first unprivileged port on CORE. Try removing the portmap and set ALEX_PORT=80

EDIT2: Check what you get as output from:

sudo sysctl net.ipv4.ip_unprivileged_port_start
1 Like

Did it work with ā€œALEXA_PORT=80ā€?

Sorry, broke for dinner:

Config:

Dec 23 20:32:47.397445 Collective-Core oll-node-red[326977]: ---- CONFIG OVERRIDES START ----
Dec 23 20:32:47.401398 Collective-Core oll-node-red[327007]: PORT_MAP+=("0.0.0.0:3456:3456")
Dec 23 20:32:47.401398 Collective-Core oll-node-red[327007]: PORT_MAP+=("0.0.0.0:4567:4567")
Dec 23 20:32:47.401398 Collective-Core oll-node-red[327007]: PORT_MAP+=("192.168.2.242:1900:1900/udp")
Dec 23 20:32:47.401398 Collective-Core oll-node-red[327007]: REDACTED
Dec 23 20:32:47.401398 Collective-Core oll-node-red[327007]: ENV_MAP+=("ALEXA_PORT=80") # Used port mapping instead
Dec 23 20:32:47.401398 Collective-Core oll-node-red[327007]: ENV_MAP+=("NODE_RED_ENABLE_SAFE_MODE=true")

Result:

Dec 23 20:32:03.980159 Collective-Core conmon[325413]: 23 Dec 20:32:03 - [red] Uncaught Exception:
Dec 23 20:32:03.981849 Collective-Core conmon[325413]: 23 Dec 20:32:03 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:80
Dec 23 20:32:03.981916 Collective-Core conmon[325413]:     at Server.setupListenHandle [as _listen2] (node:net:1372:16)
Dec 23 20:32:03.981936 Collective-Core conmon[325413]:     at listenInCluster (node:net:1420:12)
Dec 23 20:32:03.981952 Collective-Core conmon[325413]:     at doListen (node:net:1559:7)
Dec 23 20:32:03.981969 Collective-Core conmon[325413]:     at processTicksAndRejections (node:internal/process/task_queues:84:21)
Dec 23 20:32:04.244817 Collective-Core podman[325869]: 2022-12-23 20:32:04.24461799 -0800 PST m=+0.158529487 container died e03ed72a672785e056d773a408757b3e246321a17afd3c21f2db60a4ea5bae6d (image=container.oh-lalabs.com/oh-lalabs/node-red:3, name=oll-node-red)
Dec 23 20:32:04.396951 Collective-Core podman[325869]: 2022-12-23 20:32:04.394937775 -0800 PST m=+0.308849230 container remove e03ed72a672785e056d773a408757b3e246321a17afd3c21f2db60a4ea5bae6d (image=container.oh-lalabs.com/oh-lalabs/node-red:3, name=oll-node-red, org.label-schema.name=Node-RED, org.label-schema.vcs-url=https://github.com/node-red/node-red-docker, org.label-schema.build-date=2022-08-20T15:52:24Z, org.label-schema.docker.dockerfile=.docker/Dockerfile.marjebian, org.label-schema.url=https://nodered.org, org.label-schema.license=Apache-2.0, org.label-schema.version=, PODMAN_SYSTEMD_UNIT=podman-oll-node-red.service, org.label-schema.arch=arm64v8, org.label-schema.vcs-ref=, org.label-schema.vcs-type=Git, org.label-schema.description=Low-code programming for event-driven applications.)
Dec 23 20:32:04.416978 Collective-Core systemd[1]: podman-oll-node-red.service: Main process exited, code=exited, status=1/FAILURE
Dec 23 20:32:04.581415 Collective-Core oll-node-red[325890]: Error: no arguments are needed with --latest or --cidfile
Dec 23 20:32:04.587586 Collective-Core systemd[1]: podman-oll-node-red.service: Control process exited, code=exited, status=125/n/a
Dec 23 20:32:04.588205 Collective-Core systemd[1]: podman-oll-node-red.service: Failed with result 'exit-code'.
Dec 23 20:32:04.590292 Collective-Core systemd[1]: podman-oll-node-red.service: Consumed 8.962s CPU time.
oh-la@Collective-Core:~$ sudo sysctl net.ipv4.ip_unprivileged_port_start
net.ipv4.ip_unprivileged_port_start = 80

Edit: Added at 80:80 port map with both 0.0.0.0 and coreIP and no luck with either.

When using host networking, skip portmap for all ports. Set ā€œPORT_MAP=()ā€.

Also set environment variable ALEXA_IP=COREIP

Though not sure thatā€™ll work as intended

Trying this now:

---- CONFIG OVERRIDES START ----
REDACTED
ENV_MAP+=("ALEXA_PORT=80") # Used port mapping instead
ENV_MAP+=("NODE_RED_ENABLE_SAFE_MODE=true")

No dice, same error as usual.

ENV_MAP+=("ALEXA_IP=CORE_IP_HERE")

Did that resolve it?

EDIT: This is the part of the code mentioning that environment variable: node-red-contrib-alexa-home/alexa-hub.js at 3c1c8e8b117b9bb10549a3e33ee55f0bdc29ced0 Ā· mabunixda/node-red-contrib-alexa-home (github.com)

1 Like

DING DING DING DING DING

Thank you so much Markus, I think you cracked it!! Discovery worked and NR to alexa as well as alexa to NR works

Now, is it worth investigating if the REDACTED option is truly necessary?

1 Like

Probably not since the discovery being used wonā€™t forward without it.

Nice itā€™s working :slight_smile:

Is this Alexa integration complete? Ie are there any features missing the other one provides?

Not really, all this does is emulate a Philips Hue hub, so it is basically just lights as virtual devices, which you can do a lot with, but it isnā€™t native (for instance I use a dimmer as a mode controller with each light level another mode)

I think this one is a bit more complete, but I can get back to you on that.

Edit: Nevermind, that node is not set up the exact same and is outputting a similar error:
ā€œError: listen EADDRINUSE: address already in use :::80ā€

I see, at least itā€™s local :slight_smile:

Ok, and I also see itā€™s very old and not maintained.

If you find something more complete Iā€™m sure others would also like to hear about it. From my understanding you canā€™t get complete support and stay local. You either have to use a separate cloud service, like that other paid for one, or use portforwarding.

1 Like

Yeah I was thinking about that, it might be local, but alexa NLP is computed in AWS, so what use is it if you canā€™t even talk to her to turn this stuff on. Also I assume the app does not work without internet either.

Less roundtrip time and no additional service or portforwarding involvedā€¦

1 Like