nassir-malik / IOT-Pi3-Alexa-Automation

Use Raspberry Pi 3 as home automation device with Alexa
108 stars 107 forks source link

SOLVED: I own both echo dot 2nd gen and echo dot 3rd generation, if Alexa is NOT seeing your fauxmo Wemo plugs then you MUST USE a 3rd generation Echo dot residing on the same Wifi network as your project (for Alexa to discover the fauxmo Wemo plugs) #20

Open GadgetAngel opened 5 years ago

GadgetAngel commented 5 years ago

I have tested this theory for myself. I have three Wifi networks in my home. I had all my amazon devices on NETGEAR wifi using the 5 GHz . I have done this project before, making each of the 20 remote buttons on my Tempur-pedic bed a fauxmo device. In the ended, I added over 50 fauxmo devices to my Alexa app. I had to create 10 files, each file containing no more than five fauxmo devices each. Put all 10 scripts into cron and they all work wonderfully together.

1 Reason, Alexa may not find your devices:

During the Alexa discover devices, Alexa will only discover, at most 5 fauxmo, devices during the 45 seconds. So if you have more than 5 devices, my suggestion is that you split them up into different scripts with 5 devices per script. Now, each script will be the same expect for the TRIGGERS and the if...elif...name = 'device1' blocks.

2 Reason, Alexa may not find your devices:

You must have a 3rd generation Echo Dot on the same wifi network at you raspberry pi wifi. All Amazon Echo Dot devices use wifi to connect to the outside world. With my current project, I wanted to activate my garage door by using Alexa, but also have a website activate the door with a video of the inside of my garage. The wifi that works in that garage is on ARRIS wifi not my NETGEAR wifi network (where all my Alexa devices are located). So when I tried to discover the fauxmo devices, Alexa came up empty. So I came here, and saw that our leader recommend that an Amazon Echo Dot 2nd generation has to be on the same network. So I went and bought an Alexa Echo Dot 2nd generation from Amazon. Placed the Echo Dot 2nd generation on the ARRIS wifi and this was the output: DEBUG:root:Responding to setup.xml for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'GET /setup.xml HTTP/1.1\r\nHost: 192.168.0.50:52000\r\nAccept: /\r\n\r\n' DEBUG:root:################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Volvo Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'GET /setup.xml HTTP/1.1\r\nHost: 192.168.0.50:52001\r\nAccept: /\r\n\r\n' DEBUG:root:################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Triumph Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'GET /setup.xml HTTP/1.1\r\nHost: 192.168.0.50:52000\r\nAccept: /\r\n\r\n' DEBUG:root:################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Volvo Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'GET /setup.xml HTTP/1.1\r\nHost: 192.168.0.50:52001\r\nAccept: /\r\n\r\n' DEBUG:root:################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage

You will notice I never got a "POST" in the output list. So I decided to move one of my Echo Dot 3rd generation over to the ARRIS wifi. I of course had to do a factory reset to do this. If I did not do the factory reset, the echo dot, would just go back to the NETGEAR wifi network. So, yes, a factory reset was need to clear the NETGEAR wifi password from the device. Here is the output I got from the Echo Dot 3rd gen. (by this time I had factory reset the echo 2nd gen and powered it off so it was not in my Alexa App or on the wifi network):

DEBUG:root:Listening for UPnP broadcasts DEBUG:root:got local address of 192.168.0.50 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'Volvo Garage' ready on 192.168.0.50:52000 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'Triumph Garage' ready on 192.168.0.50:52001 DEBUG:root: (Volvo) Left_garage_door closed DEBUG:root: (Volvo) Left_garage_door_previous_action open DEBUG:root: (Triumph) Right_garage_door closed DEBUG:root: (Triumph) Right_garage_door_previous_action open DEBUG:root:Entering fauxmo polling loop DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'GET /setup.xml HTTP/1.1\r\nContent-Type: application/json\r\nUser-Agent: Dalvik/2.1.0 (Linux; U; Android 7.1.2; AEODN Build/NS6531)\r\nHost: 192.168.0.50:52000\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip\r\n\r\n' DEBUG:root:################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Volvo Garage DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'GET /setup.xml HTTP/1.1\r\nContent-Type: application/json\r\nUser-Agent: Dalvik/2.1.0 (Linux; U; Android 7.1.2; AEODN Build/NS6531)\r\nHost: 192.168.0.50:52001\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip\r\n\r\n' DEBUG:root:################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Triumph Garage DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'POST /upnp/control/basicevent1 HTTP/1.1\r\nSOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"\r\nContent-Type: text/xml; charset="utf-8"\r\nAccept: \r\nUser-Agent: Dalvik/2.1.0 (Linux; U; Android 7.1.2; AEODN Build/NS6531)\r\nHost: 192.168.0.50:52000\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip\r\nContent-Length: 299\r\n\r\n<?xml version="1.0" encoding="utf-8"?>1</u:GetBinaryState></s:Body></s:Envelope>' DEBUG:root:################################## handle_reques ####################### DEBUG:root:################################## response ####################### DEBUG:root:POST /upnp/control/basicevent1 HTTP/1.1 SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState" Content-Type: text/xml; charset="utf-8" Accept: User-Agent: Dalvik/2.1.0 (Linux; U; Android 7.1.2; AEODN Build/NS6531) Host: 192.168.0.50:52000 Connection: Keep-Alive Accept-Encoding: gzip Content-Length: 299

<?xml version="1.0" encoding="utf-8"?>1</u:GetBinaryState></s:Body></s:Envelope> DEBUG:root:################################## handle_reques ####################### DEBUG:root:b'POST /upnp/control/basicevent1 HTTP/1.1\r\nSOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"\r\nContent-Type: text/xml; charset="utf-8"\r\nAccept: \r\nUser-Agent: Dalvik/2.1.0 (Linux; U; Android 7.1.2; AEODN Build/NS6531)\r\nHost: 192.168.0.50:52001\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip\r\nContent-Length: 299\r\n\r\n<?xml version="1.0" encoding="utf-8"?>1</u:GetBinaryState></s:Body></s:Envelope>' DEBUG:root:################################## handle_reques ####################### DEBUG:root:################################## response ####################### DEBUG:root:POST /upnp/control/basicevent1 HTTP/1.1 SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState" Content-Type: text/xml; charset="utf-8" Accept: User-Agent: Dalvik/2.1.0 (Linux; U; Android 7.1.2; AEODN Build/NS6531) Host: 192.168.0.50:52001 Connection: Keep-Alive Accept-Encoding: gzip Content-Length: 299

3 Reason,Alexa may not find your devices:

Well this one is not a reason. Alexa my tell you via her voice "no devices found", but there were devices found!!. So instead of initiating the discover devices verbally, I go to my Alexa App and select Devices in the lower Right Corner, then wait for the devices to start listing on my output screen from the script (this part): DEBUG:root:Listening for UPnP broadcasts DEBUG:root:got local address of 192.168.0.50 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'Volvo Garage' ready on 192.168.0.50:52000 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'Triumph Garage' ready on 192.168.0.50:52001 DEBUG:root: (Volvo) Left_garage_door closed DEBUG:root: (Volvo) Left_garage_door_previous_action open DEBUG:root: (Triumph) Right_garage_door closed DEBUG:root: (Triumph) Right_garage_door_previous_action open DEBUG:root:Entering fauxmo polling loop DEBUG:root:Responding to search for Volvo Garage DEBUG:root:Responding to search for Triumph Garage DEBUG:root:Responding to search for Volvo Garage .. will "eep repeating the device list....

Once I am past this point then in my Alexa App I hit the + (plus sign), in the upper RIGHT Corner, and then select "Add Device", then select "Plug", then select "Wemo", then select "Discover Devices". Alexa will come back with the number of devices she has found. If you still have not found your devices, reduce the number is she looking at (see #1 Reason above). If Alexa still has not found your devices try running discovery again. If after that your devices are not found and you have a Echo Dot 3rd generation on the same wifi and your raspberry pi, all I can say is start putting in logging.debug statements to see where the software is getting hung up at.

Since the output from the Echo 2nd generation Dot never puts out a "POST" command, I concluded that the Alexa Echo 2nd Gen no longer gives the appropriate response for the fauxmo devices. So get yourself an Echo 3rd Gen device and make sure you place it on the same wifi as your raspberry pi. Now the Alexa App can be running on any wifi network you want. What matters is the Echo 3rd gen DOT is on the SAME Wifi as your raspberry pi wifi network. I did not test to see if I had the raspberry pi on ARRIS hardwired network if it would work, but I suspect it would work.

In my home the ARRIS wifi is 192.168.0.X while the NETGEAR is 192.168.1.X.

By the way if you wait, Amazon Prime Days starts on July 15 and you will be able to pick up an Amazon Echo Dot 3rd generate for $24.99 ($25.00 off)

I hope this helps someone get there fauxmo devices working.

Regards, GadgetAngel

Bagly commented 4 years ago

Sill having the same problem, using a 3rd Gen Dot on the same wifi as the Pi. Only trying to find one fauxmo device, getting the following output: (IP censored) DEBUG:root:Listening for UPnP broadcasts DEBUG:root:got local address of 192.168.00.000 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'Curtain' ready on 192.168.00.000:52000 DEBUG:root:Entering fauxmo polling loop DEBUG:root:Responding to search for Curtain DEBUG:root:Responding to search for Curtain DEBUG:root:Responding to search for Curtain ################################## handle_reques ####################### b'GET /setup.xml HTTP/1.1\r\nHost: 192.168.00.000:52000\r\nAccept: /\r\nContent-Type: application/json\r\n\r\n' ################################## handle_reques ####################### DEBUG:root:Responding to setup.xml for Curtain DEBUG:root:Responding to search for Curtain DEBUG:root:Responding to search for Curtain

Im brand new to this sort of thing so please forgive me if I'm being oblivious to something. Cheers