n8henrie / fauxmo

Emulated Belkin WeMo devices that work with the Amazon Echo
https://n8henrie.com/2016/02/fauxmo-home-automation-with-the-amazon-echo-raspberry-pi-and-homeassistant/
Other
377 stars 78 forks source link

Alexa unable to find any device #103

Closed kovi44 closed 4 years ago

kovi44 commented 4 years ago

My Issue

If asked alexa to discover local devices, then it is unable to find any device.

WHYT

Please see attached debug output, I can see the communication of my SONOS speakers. If I asked alexa to discover a new devices, I could not see any request from network.

Echo device using the same network as my raspberry pi.

MY CONFIG

{
    "FAUXMO": {
        "ip_address": "192.168.1.49"
    },
    "PLUGINS": {
        "SimpleHTTPPlugin": {
            "DEVICES": [
                {
                    "port": 12340,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=1",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=1",
                    "method": "GET",
                    "name": "livingroom light one"
                },
        {
                    "port": 12341,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=2",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=2",
                    "method": "GET",
                    "name": "livingroom light two"
                },
        {
                    "port": 12342,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=3",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=3",
                    "method": "GET",
                    "name": "livingroom light three"
                },
                {
                    "port": 12343,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=4",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=4",
                    "method": "GET",
                    "name": "kitchen light one"
                },
        {
                    "port": 12344,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=5",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=5",
                    "method": "GET",
                    "name": "kitchen light two"
                },
                {
                    "port": 12345,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=6",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=6",
                    "method": "GET",
                    "name": "fireplace light"
                },
        {
                    "port": 12346,
                    "on_cmd": "http://192.168.1.53/?cmd=on&id=7",
                    "off_cmd": "http://192.168.1.53/?cmd=off&id=7",
                    "method": "GET",
                    "name": "garden light"
                }
            ]
        }
    }
}

DEBUG OUTPUT

root@raspberrypi:~# fauxmo -c /etc/fauxmo/config.json -vvv
2020-07-20 09:01:59 fauxmo:42       INFO     Fauxmo v0.5.0
2020-07-20 09:01:59 fauxmo:43       DEBUG    3.7.3 (default, Dec 20 2019, 18:57:59) 
[GCC 8.3.0]
2020-07-20 09:01:59 fauxmo:40       DEBUG    Using IP address: 192.168.1.49
2020-07-20 09:01:59 fauxmo:112      DEBUG    plugin_vars: {}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12340, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=1', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=1', 'method': 'GET', 'name': 'livingroom light one'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12340)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'livingroom light one', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5efa090>}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12341, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=2', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=2', 'method': 'GET', 'name': 'livingroom light two'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=8, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12341)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'livingroom light two', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5ef3bb0>}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12342, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=3', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=3', 'method': 'GET', 'name': 'livingroom light three'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12342)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'livingroom light three', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5e380b0>}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12343, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=4', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=4', 'method': 'GET', 'name': 'kitchen light one'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12343)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'kitchen light one', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5efa490>}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12344, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=5', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=5', 'method': 'GET', 'name': 'kitchen light two'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12344)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'kitchen light two', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5e38650>}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12345, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=6', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=6', 'method': 'GET', 'name': 'fireplace light'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12345)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'fireplace light', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5d8e070>}
2020-07-20 09:01:59 fauxmo:115      DEBUG    device config: {'port': 12346, 'on_cmd': 'http://192.168.1.53/?cmd=on&id=7', 'off_cmd': 'http://192.168.1.53/?cmd=off&id=7', 'method': 'GET', 'name': 'garden light'}
2020-07-20 09:01:59 asyncio:1403     INFO     <Server sockets=[<socket.socket fd=13, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.49', 12346)>]> is serving
2020-07-20 09:01:59 fauxmo:134      DEBUG    Started fauxmo device: {'name': 'garden light', 'plugin': <fauxmo.plugins.simplehttpplugin.SimpleHTTPPlugin object at 0xb5d8e250>}
2020-07-20 09:01:59 fauxmo:136      INFO     Starting UDP server
2020-07-20 09:01:59 asyncio:1259     DEBUG    Datagram endpoint remote_addr=None created: (<_SelectorDatagramTransport fd=14 read=idle write=<idle, bufsize=0>>, <fauxmo.protocols.SSDPServer object at 0xb5efa470>)
2020-07-20 09:02:04 asyncio:1729     INFO     poll took 4254.054 ms: 1 events
2020-07-20 09:02:04 fauxmo:344      DEBUG    Received data below from ('192.168.1.46', 46763):
2020-07-20 09:02:04 fauxmo:345      DEBUG    NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = 1800
LOCATION: http://192.168.1.46:1400/xml/device_description.xml
NT: uuid:RINCON_7828CAEC539001400
NTS: ssdp:alive
SERVER: Linux UPnP/1.0 Sonos/58.1-78090 (ZPS18)
USN: uuid:RINCON_7828CAEC539001400
X-RINCON-HOUSEHOLD: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF
X-RINCON-BOOTSEQ: 11
BOOTID.UPNP.ORG: 11
X-RINCON-WIFIMODE: 1
X-RINCON-VARIANT: 1
HOUSEHOLD.SMARTSPEAKER.AUDIO: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF.FaBTzrWj1c91dpcbUgcF

2020-07-20 09:02:04 asyncio:1729     DEBUG    poll took 24.642 ms: 1 events
2020-07-20 09:02:04 fauxmo:344      DEBUG    Received data below from ('192.168.1.44', 40973):
2020-07-20 09:02:04 fauxmo:345      DEBUG    NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = 1800
LOCATION: http://192.168.1.44:1400/xml/device_description.xml
NT: uuid:RINCON_347E5C74218901400
NTS: ssdp:alive
SERVER: Linux UPnP/1.0 Sonos/58.1-78090 (ZPS9)
USN: uuid:RINCON_347E5C74218901400
X-RINCON-HOUSEHOLD: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF
X-RINCON-BOOTSEQ: 82
BOOTID.UPNP.ORG: 82
X-RINCON-WIFIMODE: 1
X-RINCON-VARIANT: 2
HOUSEHOLD.SMARTSPEAKER.AUDIO: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF.FaBTzrWj1c91dpcbUgcF

2020-07-20 09:02:04 asyncio:1729     DEBUG    poll took 224.417 ms: 1 events
2020-07-20 09:02:04 fauxmo:344      DEBUG    Received data below from ('192.168.1.46', 46763):
2020-07-20 09:02:04 fauxmo:345      DEBUG    NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = 1800
LOCATION: http://192.168.1.46:1400/xml/device_description.xml
NT: urn:schemas-upnp-org:device:ZonePlayer:1
NTS: ssdp:alive
SERVER: Linux UPnP/1.0 Sonos/58.1-78090 (ZPS18)
USN: uuid:RINCON_7828CAEC539001400::urn:schemas-upnp-org:device:ZonePlayer:1
X-RINCON-HOUSEHOLD: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF
X-RINCON-BOOTSEQ: 11
BOOTID.UPNP.ORG: 11
X-RINCON-WIFIMODE: 1
X-RINCON-VARIANT: 1
HOUSEHOLD.SMARTSPEAKER.AUDIO: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF.FaBTzrWj1c91dpcbUgcF

2020-07-20 09:02:04 asyncio:1729     DEBUG    poll took 20.282 ms: 1 events
2020-07-20 09:02:04 fauxmo:344      DEBUG    Received data below from ('192.168.1.44', 40973):
2020-07-20 09:02:04 fauxmo:345      DEBUG    NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = 1800
LOCATION: http://192.168.1.44:1400/xml/device_description.xml
NT: urn:schemas-upnp-org:device:ZonePlayer:1
NTS: ssdp:alive
SERVER: Linux UPnP/1.0 Sonos/58.1-78090 (ZPS9)
USN: uuid:RINCON_347E5C74218901400::urn:schemas-upnp-org:device:ZonePlayer:1
X-RINCON-HOUSEHOLD: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF
X-RINCON-BOOTSEQ: 82
BOOTID.UPNP.ORG: 82
X-RINCON-WIFIMODE: 1
X-RINCON-VARIANT: 2
HOUSEHOLD.SMARTSPEAKER.AUDIO: Sonos_B9qOZJfLPsWvombgC7eI2oRqkF.FaBTzrWj1c91dpcbUgcF
n8henrie commented 4 years ago

Thanks for the complete issue report!

Can you elaborate on this:

logging into my profile, or resetting the echo device to be registered to my profile is consistently successful in connecting to and controlling fauxmo devices.

So are you trying to get it to work without being logged into an account? Please go into more detail about the circumstances under which you are getting it to work, and how that's difference from what you're hoping to achieve.

Also, it looks like the log was only running for 5 seconds -- I presume you are running it for longer but truncated because there is nothing else to see?

Any firewall running on the device running Fauxmo?

kovi44 commented 4 years ago

Hi,

logging into my profile, or resetting the echo device to be registered to my profile is consistently successful in connecting to and controlling fauxmo devices. Statement above: This was an mistake - I just copy another report and forget to remove, sorry.

The 5sec. dump is just to not sharing long data, basically all the time the same messages from my sonos devices. I run it for several hours and tried to discover a new devices several times using IOS app and echo dot show, but the issue is that I do not see any communication coming from echo.

I added my firewall rules

iptables -vL
Chain INPUT (policy ACCEPT 177K packets, 27M bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
21230  922K ACCEPT     tcp  --  any    any     anywhere             192.168.1.9          tcp dpt:8000 state NEW,RELATED,ESTABLISHED
    0     0 ACCEPT     tcp  --  tun0   eth1    anywhere             anywhere             tcp dpt:8000 flags:FIN,SYN,RST,ACK/SYN ctstate NEW
    0     0 ACCEPT     all  --  tun0   eth1    anywhere             anywhere             ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     tcp  --  tun0   eth0    anywhere             anywhere             tcp dpt:8000 flags:FIN,SYN,RST,ACK/SYN ctstate NEW
 1290 88239 ACCEPT     all  --  tun0   eth0    anywhere             anywhere             ctstate RELATED,ESTABLISHED
22779   26M ACCEPT     all  --  eth0   tun0    anywhere             anywhere             ctstate RELATED,ESTABLISHED
  553 22460 ACCEPT     tcp  --  tun0   eth0    anywhere             anywhere             tcp dpt:http-alt flags:FIN,SYN,RST,ACK/SYN ctstate NEW
    6   312 ACCEPT     tcp  --  tun0   eth0    anywhere             anywhere             tcp dpt:rtsp flags:FIN,SYN,RST,ACK/SYN ctstate NEW
  351 19292 ACCEPT     tcp  --  tun0   eth0    anywhere             anywhere             tcp dpt:81 flags:FIN,SYN,RST,ACK/SYN ctstate NEW

Chain OUTPUT (policy ACCEPT 149K packets, 46M bytes)
 pkts bytes target     prot opt in     out     source               destination     

so seems that I do not block any UDP data flow

both devices are using the same WIFI (UNIFI), no host isolation or any additional security settings. Strange is that I can see the Sonos speakers, which are on WIFI as well. I can see the SONOS communication on fauxmo in debug mode and my Echo Dot Show is able to find SONOS speakers too

n8henrie commented 4 years ago

Odd.

I'm far from a firewall expert, but the first thing I would try is temporarily disabling your firewall to see if that changes anything.

Also, I assume you've triple checked the static IP address you're using?

kovi44 commented 4 years ago

Honestly, I already tried everything. Nothing really helps, I got no clue what else to verify.

  1. there si no network limitation like firewall, one can see in debug log of fauxmo that broadcast message to 239.255.255.250:1900 are coming succesfully , my SONOS speakers can be visible in the log. If I understand correctly then as soon as I request alexa to discover local devoces a brodcast message should be visible in the log (no such a msg at all)

  2. no wifi host isolation is configured on the wifi (my sonos speakers are connected to the same wifi as my echo dot show)

  3. i tried sample config for fauxmo and several other, which works for my friends

  4. I tried to do factory reset of my Alexa Echo show

  5. My alexa echo show is able to find another devices on the network like doorbell or Sonos speaker

What else i should check to make it run?

n8henrie commented 4 years ago

Huh, this is an odd one.

there si no network limitation like firewall

This conflicts with your earlier statement:

I added my firewall rules

Yes, I think you're likely right that it's not the firewall. But my comment was this was the first thing that I would try; it is certainly possible to have firewall rules that restrict traffic coming to or from a specific host, so the fact that your sonos can broadcast doesn't necessarily rule this out, though it does make it less likely.

My next guess would be that it could be related to the Echo Show. I don't have one of these to test with, and I'm not sure whether I've had others use Fauxmo with a Show. Fauxmo has failed to work with some Alexa devices in the past, such as the wand as well as the webapp. Do you have another Echo device to test with?

Can you ping the Echo from your Raspberry Pi? If so, have you looked through the example tcpdump commands to see if there are any broadcasts coming from the Echo when you discover devices?

If not, there's not a whole lot that can be done on my end.

If so, please post and perhaps Fauxmo can be reconfigured to recognize whatever it is doing differently.

EDIT: Please also update your initial post with the Echo firmware version.

kovi44 commented 4 years ago

Let me share my analysis

I checked using tcpdump requests from Echo Dot Show. I can see the udp broadcast packets comming to my eth0 interface, which is also configured in fauxmo json config file. (tcpdump -n udp dst port 1900 -A) If I tried command to emulate request from Echo (echo -e "M-SEARCH" | nc.traditional -q 1 -u 239.255.255.250 1900) then I can see it in debug mode of fauxmo

In debug mode in fauxmo I could not see any request from that device

I am able to ping the echo dot show from raspberry.

I will try to connect another echo device to see if there will be any difference and let you know

I also tested using fauxmo v0.4.9 0 same result

kovi44 commented 4 years ago

Hi all,

finally I found the issue!!! The issue was with routing table, if you have configured several interface (ifconfig), the be sure that your traffic is routed correctly!

to solve it please use command like "route add -net 239.0.0.0 netmask 255.0.0.0 eth0" where eth0 is interface using which the traffic should be routed

n8henrie commented 4 years ago

I would not have figured that out. Great work and thanks for sharing the solution!