Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Detect Device #66

Open
namirda opened this issue Oct 4, 2019 · 23 comments
Open

Cannot Detect Device #66

namirda opened this issue Oct 4, 2019 · 23 comments

Comments

@namirda
Copy link

namirda commented Oct 4, 2019

SUMMARY

Using latest node-red docker image and simplest possible flow including node-red-contrib-amazon-echo, my Echo Dot Gen 2 does not detect the new device.

ECHO DEVICES

Echo Dot Gen 2

CONFIGURATION
[
    {
        "id": "b086970.b6efa68",
        "type": "tab",
        "label": "Test Amazon Echo Hub",
        "disabled": false,
        "info": ""
    },
    {
        "id": "ab63c24f.c22c3",
        "type": "amazon-echo-hub",
        "z": "b086970.b6efa68",
        "port": "8001",
        "enableinput": true,
        "x": 228.4002456665039,
        "y": 72.00000762939453,
        "wires": [
            [
                "5ed91aba.792fc4"
            ]
        ]
    },
    {
        "id": "5ed91aba.792fc4",
        "type": "amazon-echo-device",
        "z": "b086970.b6efa68",
        "name": "Test Device",
        "topic": "/cmd/test",
        "x": 507.40000915527344,
        "y": 73.00000667572021,
        "wires": [
            [
                "3c366ba2.471924"
            ]
        ]
    },
    {
        "id": "3c366ba2.471924",
        "type": "debug",
        "z": "b086970.b6efa68",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 744.4002075195312,
        "y": 73.00000762939453,
        "wires": []
    }
]

CONSOLE OUTPUT
node-red2   |
node-red2   | > node-red-docker@1.0.0 start /usr/src/node-red
node-red2   | > node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"
node-red2   |
node-red2   | 4 Oct 18:38:51 - [info]
node-red2   |
node-red2   | Welcome to Node-RED
node-red2   | ===================
node-red2   |
node-red2   | 4 Oct 18:38:51 - [info] Node-RED version: v1.0.0
node-red2   | 4 Oct 18:38:51 - [info] Node.js  version: v10.16.3
node-red2   | 4 Oct 18:38:51 - [info] Linux 4.4.132-1075-rockchip-ayufan-ga83beded8524 arm LE
node-red2   | 4 Oct 18:38:52 - [info] Loading palette nodes
node-red2   | 4 Oct 18:38:52 - [debug] Module: node-red-contrib-amazon-echo 0.1.8
node-red2   | 4 Oct 18:38:52 - [debug]         /data/node_modules/node-red-contrib-amazon-echo
node-red2   | 4 Oct 18:38:52 - [debug] Module: node-red-node-rbe 0.2.5
node-red2   | 4 Oct 18:38:52 - [debug]         /usr/src/node-red/node_modules/node-red-node-rbe
node-red2   | 4 Oct 18:38:52 - [debug] Module: node-red-node-tail 0.0.3
node-red2   | 4 Oct 18:38:52 - [debug]         /usr/src/node-red/node_modules/node-red-node-tail
node-red2   | 4 Oct 18:38:56 - [info] Settings file  : /data/settings.js
node-red2   | 4 Oct 18:38:56 - [info] Context store  : 'default' [module=memory]
node-red2   | 4 Oct 18:38:56 - [info] User directory : /data
node-red2   | 4 Oct 18:38:56 - [warn] Projects disabled : editorTheme.projects.enabled=false
node-red2   | 4 Oct 18:38:56 - [info] Flows file     : /data/flows.json
node-red2   | 4 Oct 18:38:56 - [debug] loaded flow revision: 93850d7fe56209be08a6fce2f4d91543
node-red2   | 4 Oct 18:38:56 - [debug] red/runtime/nodes/credentials.load : no user key present
node-red2   | 4 Oct 18:38:56 - [debug] red/runtime/nodes/credentials.load : using default key
node-red2   | 4 Oct 18:38:56 - [debug] red/runtime/nodes/credentials.load : keyType=system
node-red2   | 4 Oct 18:38:56 - [warn]
node-red2   |
node-red2   | ---------------------------------------------------------------------
node-red2   | Your flow credentials file is encrypted using a system-generated key.
node-red2   |
node-red2   | If the system-generated key is lost for any reason, your credentials
node-red2   | file will not be recoverable, you will have to delete it and re-enter
node-red2   | your credentials.
node-red2   |
node-red2   | You should set your own key using the 'credentialSecret' option in
node-red2   | your settings file. Node-RED will then re-encrypt your credentials
node-red2   | file using your chosen key the next time you deploy a change.
node-red2   | ---------------------------------------------------------------------
node-red2   |
node-red2   | 4 Oct 18:38:56 - [info] Starting flows
node-red2   | 4 Oct 18:38:56 - [debug] red/nodes/flows.start : starting flow : global
node-red2   | 4 Oct 18:38:56 - [debug] red/nodes/flows.start : starting flow : b086970.b6efa68
node-red2   | 4 Oct 18:38:56 - [info] Started flows
node-red2   | 4 Oct 18:38:56 - [info] Server now running at http://127.0.0.1:1880/

##### STEPS TO REPRODUCE
Docker container started using the following docker-compose.yml:

version: '3.7'
services:
  node-red:
    container_name: node-red2

    image: nodered/node-red

    user: root

    volumes:
      - /docker/node-red2/config:/data

    network_mode: host

    restart: unless-stopped

##### ACTUAL RESULTS

Node-Red gui shows Amazon Echo Hub as being "online" but no new devices detected when I initiate a scan either from the Alexa app or the Dot.

What am I doing wrong here?

Thanks
@datech
Copy link
Owner

datech commented Oct 4, 2019

Hi @namirda. Echo will try to connect on port 80, and your Amazon Echo Hub is running on port 8001.

@namirda
Copy link
Author

namirda commented Oct 4, 2019

Thanks @datech - I thought the port 80 restriction was only for Gen3 devices?

I have tried restarting the container mapping port 80 on the host to 8001 in the container but still no joy.

@Barabba11
Copy link

be sure you're correctly respecting the map procedure, the instructions has been posted here in some threads, we all are using here this way and works to everybody

@datech
Copy link
Owner

datech commented Oct 4, 2019

Yep, I haven't noticed that you are using Dot v2.

I'm thinking of a few potential issues:

- Node Red instance and Echo Dot are in separate broadcast domains (different networks).
"network_mode: host" configuration will set your Docker container to use your host network.

Can you confirm that your Docker host and the Echo Dot are using the same network?

- Amazon Echo Hub is not accessible by the Echo dot.

Can you confirm that you can open: http://<docker-ip>:<hub-port>/api/description.xml

@namirda
Copy link
Author

namirda commented Oct 4, 2019

@datech - thanks for your help...

  1. Yes - docker host and echo dot are both in the same network
  2. Yes - I can access description.xml using curl from the docker host which is headless - and also from my laptop using a browser.

When the Amazon Echo Hub says that it is online, what does that mean exactly??

@datech
Copy link
Owner

datech commented Oct 4, 2019

It just means that the hub is successfully started on the selected port.

To check that the discovery procedure is working you can run the SSDP server in debug mode by setting an env variable DEBUG="node-ssdp:*"

I've used the following commands on my Linux box.

export DEBUG="node-ssdp:*"; 
node-red

If Echo Dot and the Hub can communicate with each other, you have to find similar log messages on the console

node-ssdp:server Setting LOCATION header "http://<hub-ip>:80/description.xml" on message ID 574436eb7a65d496 +1ms
  node-ssdp:server Sending a message to <echo-ip>:50000 +2ms

@Barabba11
Copy link

chances are your router is blockeing the broadcast ARP, I have lo clue if Echo does reply to ping, but it would be useful to try to ping Echo from your Raspberry, if it replies then your network is ok

@namirda
Copy link
Author

namirda commented Oct 4, 2019

@datech - thanks.

I have set the DEBUG environment variable as you suggested. The log file is now very large but I can see the ssdp records which you described:

node-red2 | 2019-10-04T21:12:25.920Z node-ssdp:server Setting LOCATION header "http://192.168.1.79:8001/description.xml" on message ID f297e63c12a8449b node-red2 | 2019-10-04T21:12:25.920Z node-ssdp:server Sending a message to 192.168.1.66:50000

where 192.168.1.66 is the ip of the echo and 192.168.1.79 is the ip of the docker host.

I do not see any error messages in the console.

There are a lot of new records generated in the console when I try to discover new devices - so it does look as if the dot and hub are communicating. However discovery still fails.

@Barabba11 - Thanks. My Echo does NOT respond to pings. Does yours?

@Barabba11
Copy link

I haven't tried it, I can't now sorry, anyway they are communicating, so it's not influent. Network is ok

@namirda
Copy link
Author

namirda commented Oct 7, 2019

@Barabba11, @datech - Yes it looks as if the network is probably OK - but there is still no device discovery. What else can be going wrong here?

@marc-gist
Copy link

Having the same issue with Node-Red in docker. I too can access the description.xml.

@marc-gist
Copy link

Sorry, solved my issue reading your Wiki...should have read more :)
https://github.com/datech/node-red-contrib-amazon-echo/wiki/Troubleshooting
Running with --user 0 --network host did the trick.

@1up-exe
Copy link

1up-exe commented Dec 14, 2019

I have the same issue as @namirda does have it.
It does not matter if my node-red running on port 80 or on 8080 with modified iptables. Is there any solution?

@Barabba11
Copy link

Chances are you not correctly remap the port to 80, or 80 is in use by something else

@ChazBurkhart
Copy link

Can someone who has figured this make a walkthrough showing how they did it. Everyone is talking way over my head. I have no idea where these commands are coming from or going to.

@Barabba11
Copy link

Has it worked one time? Never?
WHich platform are you using? Raspberry?
Are you connected with cable, wifi or both?
If you connect to the IP of your device, on port 80, what is the result appearing?

@Barabba11
Copy link

#5
Read this carefully

@ChazBurkhart
Copy link

I am using an UnRaid server. It worked when I had it on a Raspberry Pi.
It has never worked on UnRaid.
My server is connected through a cable and my echo devices are all wireless.
My UnRaid Server is running on 192.168.40.100, NodeRed is 192.168.40.100:1880, if I use 192.168.40.100:80 it takes me to my Unraid Server Homepage

@Barabba11
Copy link

192.168.40.100:80 it takes me to my Unraid Server Homepage

You got the problem, the port 80 is already in use, you need absolutely to free it from this "Unraid Server Homepage", google to know how to

@ChazBurkhart
Copy link

Alright sweet. Got that taken care of, Unraid Server Homepage moved to port 8080. However, 192.168.40.100:80 doesn't take me anywhere now. "Unable to connect"

@Barabba11
Copy link

have you tried restart? You need to be sure the port 80 will be used from this module, try a netstat -a. To test it open the address of your Unraid server in browser and you will see a 404 error, means the server works. Actually I don't know which is the right address to type to have a proper answer

@truresma
Copy link

it's a pity no one here writes the answer...

  1. sudo iptables -t nat -L --line-numbers (if it doesn't say anything about 8083/your port, then it's clear that it doesn't work)
  2. sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
  3. sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8083
  4. For the Node-Red Adapter insert port 8083 at the "Amazon Echo Hub" node and click deploy in the upper right corner and it works or it finds the devices and it is green.
  5. Another time sudo iptables -t nat -L --line-numbers (see if it says 8083, if it does then it should work)
    Now the whole thing must be saved permanently if the device is restarted
  6. sudo apt-get install iptables-persistent
  7. sudo bash -c "iptables-save > /etc/iptables/rules" | or service iptables save | if the 1 does not work, in any case the problem is the saving

It does not work with most of them because it is not saved permanently and the port forwarding is gone again at the next restart. Therefore save the iptable or port forwarding at the end.


Ich finde es schade, dass keiner hier die Lösung schreibt...

  1. sudo iptables -t nat -L --line-numbers (wenn hier nichts von 8083/euren Port steht, dann ist es klar, dass es nicht geht)
  2. sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
  3. sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8083
  4. Bei dem Node-Red Adapter bei dem "Amazon Echo Hub" Node den Port 8083 einfügen und oben rechts deploy klicken und es funktioniert bzw. er findet nun die Geräte und es ist grün.
  5. Nochmal sudo iptables -t nat -L --line-numbers (gucken ob da nun 8083 steht, wenn ja dann sollte es gehen)
    Nun muss das Ganze noch dauerhaft gespeichert werden falls das Gerät neugestartet wird
  6. sudo apt-get install iptables-persistent
  7. sudo bash -c "iptables-save > /etc/iptables/rules" | oder service iptables save falls das 1 nicht gehen sollte, auf jeden Fall ist die Speicherung das Problem

Es geht bei den meisten nicht da es so nicht dauerhaft gespeichert wird und beim nächsten Neustart die Portweiterleitung wieder weg ist. Deshalb am Ende das iptable bzw. die Portweiterleitung speichern.

@smilerz
Copy link

smilerz commented Oct 6, 2020

I've used the following commands on my Linux box.

export DEBUG="node-ssdp:*"; 
node-red

@datech - where is this set? I've confirmed that I can connect to http://x.x.x.x/api/description.xml but am at a loss as to where to go next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants