datech / node-red-contrib-amazon-echo

Alexa controlled Node-Red nodes supporting latest Amazon Echo devices. NO Alexa Skills required. NO cloud dependencies.
MIT License
140 stars 42 forks source link

New devices not discoverable (HomeAssistant) #169

Open Writech opened 3 years ago

Writech commented 3 years ago
SUMMARY

I have Amazon Echo Dot (3rd gen). I'm using HomeAssistant on Raspberry Pi 4.

From some unknown time on I'm unable to discover new devices. Found the issue when I was trying to add new device after quite some time since the last device was added. I was able to add and use the devices before and I'm still able to control the already added devices. I'm not able to discover new devices however.

If I add new amazon echo device node in NodeRed for example with name Test Device and I start device discovery in Alexa app it says after some time looking for new devices No new devices found..

The virtual Philips Hub (created by amazon echo hub node) is accessible on my HomeAssistant server on port 80 from my laptop. I'm able to get the xml from http://<homeassistant-server-ip>/description.xml and json on http://<homeassistant-server-ip>/api/description.xml.

All previously added devices (when the discovery was still functioning) are working fine - I'm able to control them via voice commands and also from Alexa app. When I delete one of these devices however (delete from Alexa app and delete the node in NodeRed), I'm not able to re-discover them afterwards when I create the device with the same name again. Alexa app says No new devices found.. The newly added node/device is however listed in /api/description.xml which makes me wonder why Echo can't discover the device even if it's listed there.

So far I have tried:

I'm out of ideas why the discovery doesn't function anymore...

ECHO DEVICES
MODULE VERSION
node-red-contrib-amazon-echo@0.1.10
CONFIGURATION
CONSOLE OUTPUT
STEPS TO REPRODUCE
EXPECTED RESULTS

When new amazon echo device is created in NodeRed and deployed it is discoverable by Alexa app.

ACTUAL RESULTS

When new amazon echo device is created in NodeRed and deployed it is NOT discoverable by Alexa app. Alexa app says No new devices found. after looking for new devices. The new amazon echo device is however listed in /api/description.xml. I'm able to control and use devices that were added at the time when discovery was still functioning. When I delete one of these devices I'm not able to re-discover it again afterwards.

Barabba11 commented 3 years ago

It's a sad behaviour of Dot devices, they always had firmware issues.. they still update and fail, this is my experience. I don't see anything wrong with this module. Try to use unique names by one word only, be suere Echo resets to the factory settings titself when you disassociate it from amazon account

flyize commented 3 years ago

Ever find a fix for this?

slbailey commented 3 years ago

I have the same issue. My description.xml has a null services list. Not sure when this started but any devices removed from the hub are not discoverable again.

Barabba11 commented 3 years ago

you'd better move to https://flows.nodered.org/node/node-red-contrib-virtual-smart-home

slbailey commented 3 years ago

you'd better move to https://flows.nodered.org/node/node-red-contrib-virtual-smart-home

I'm concerned about that project because the "donation" link included states the author needs to pay for "backend services" -- how much dependency do we have on him keeping the lights on? Not a fan of having my house depend on the kindness and generosity of someone else.

mtgpcs commented 3 years ago

I don't know if you saw this.

"Q: Can I run my own backend?

A: Yes! Check out the backend repository and follow the instructions precisely. Keep in mind that it might be cheaper to keep using the official backend and donate some money so that I can keep the system up for you."

esomashekar commented 2 years ago

I've run into the same problem. Old devices work but no now devices are discoverable as the @Writech first reported. Has anyone found a solution short of switching to a different node-red implementation?

esomashekar commented 2 years ago

I finally figured out what my problem was. I have multiple Wifi SSIDs deployed at home. All my IOT devices are on a segregated SSID with restricted access to my servers (eg. Home Assistant server). I do have mDNS configured to get around some of these issues so discovery should work, but it doesn't. As a workaround, I put one of my Amazon Echo dot devices, on the unrestricted SSID (therefore giving it full access to everything on my network). Then used this Echo Dot to initiate the "Discover New Devices" and it discovered the new nodes I had added!

Posting the results of my investigation in case anyone else runs into this problem for the same reason that I did.

Writech commented 2 years ago

I now finally factory reset my Amazon Echo Dot (3rd gen) and set it up again. I was expecting this to fix the issue of not discovering any devices in my network but it did not. I now removed all my device nodes from NodeRed and I'm unable to re-add them because device discovery is not working.

Just to clarify I have the Echo, HomeAssistant and all of my other smart home devices in the same wifi network. There is no firewall or any vlans set up. Upnp is not disabled in my router. The url http://<homeassistant-server-ip>/api/description.xml is still publicly accessible from within the local network.

I did some reading and found out Echo uses SSDP protocol to discover any devices to add. Given this I should be able to see SSDP M-SEARCH packets in Wireshark but I'm not seeing any M-SEARCH packets coming from the ip address of my echo nor do I see any NOTIFY packets coming from my homeassistant ip address when I manually send SSDP M-SEARCH packets from my laptop (which is in the same private network as my every other device). I see NOTIFY packets coming from my Amazon Fire TV and also from my Amazon Echo Dot.

When I trigger device discovery from the Alexa app I don't see my Echo Dot sending the M-SEARCH packet for the whole duration of device discovery.

Someone mentioned that I should change the default address of my Amazon account to a US one and not use my local address (I live in Europe) as discovering some specific devices might be disabled if Echo Dot is used in other countries. I changed my default Amazon address to a US one and also changed my Echo Dot's location address to the same US address but still device discovery doesn't work.

Is it necessary to forward some more ports to NodeRed although I doubt that because the discovery was working couple of years ago. I have been keeping my HomeAssistant Core and as well as NodeRed and any other add-ons up-to-date. It could have been that some of the updates disabled something that was required for the Philips Hue virtual device discovery to work.

Writech commented 2 years ago

After whole day of googling, fiddling around and taking a couple of Ibumetin pills for the caused headache I found the culprit - HomeAssistant's Plex Media Server addon.

Amazon Echo discovers devices via SSDP protocol. SSDP server listens on UDP port 1900. Plex Media Server addon container's UDP port 1900 is forwarded to the host machine's UDP port 1900. The NodeRed addon runs in HomeAssistant as a docker container. It needs to be able to receive multicast messages from host network which requires the container to use host network docker ... --network host .... I'm not exactly sure if --network host parameter is used to run NodeRed docker container in HomeAssistant but it probably is because in the NodeRed addon configuration page there is no 1900 port defined and node-red-contrib-amazon-echo needs to be able to listen to M-REQUEST packets on port 1900.

As the saying goes: "You can't ride two horses with one ass".

After disabling the Plex Media Server addon (which also listened on UDP port 1900) in HA, restarting NodeRed and starting device discovery again in Alexa app it finally is able to find new devices again. It could also be seen on Wireshark that HA suddenly started responding to M-REQUEST packets with NOTIFY packets.

In your case it could be some other HA addon also using the UDP port 1900. If you're also having this issue and not using the Plex Media Server addon check what ports your addons addons are using in the configuration page and try disabling them if you find any of them using UDP port 1900.