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

Alexa SmartHome skill - not finding #22

Closed
sciencegirl100 opened this issue Nov 2, 2017 · 119 comments
Closed

Alexa SmartHome skill - not finding #22

sciencegirl100 opened this issue Nov 2, 2017 · 119 comments

Comments

@sciencegirl100
Copy link

Installed on my NodeMCU, went through Alexa app to add... nothing.
So, turns out you need the smart home skill for the devices you want to add.
The WeMo skill requires you to enter your wireless SSID and the WeMo device's MAC address.
This breaks the compatibility with these wemo emulator projects unfortunately.

So, has anyone gotten past this? Is there a generic smarthome skill I'm unaware of?

P.S. I made sure all devices were on the same network and I even reset my Echo Dot. Nothing :/

@dougstrickland
Copy link

Have you tried coding your ssid in your script?
like:

const char* ssid = "My_Network";
const char* password = "XXXXXXXXXXXXXXXX";

@sciencegirl100
Copy link
Author

I set the SSID and WPA2 password, I was able to ping it from my PC as well as my phone from the same network that the Echo is on

@Braandn
Copy link

Braandn commented Nov 4, 2017

Same problem

@MacSass
Copy link

MacSass commented Nov 5, 2017

Same problem here - but only after my Alexa updated to the latest firmware.
Before I could discover the ESP emulated devices with no problem - you could monitor the answer to the Alexa search request in the serial console ...
Now, when I do a search, the ESP does not seem to "see" any broadcast request and does not respond - thus Alexa does not show any devices.
I will try with the WeMo skill, but if that required a MAC address and it only works this way it would mean we would need "false" MAC adresses???
As said - until lately no skill was needed and Alexa found the emulated Wemos devices on the ESP8266 with no problem ...

@MacSass
Copy link

MacSass commented Nov 5, 2017

Update:
Using my "old" Amazon Echo (1st generation) the devices are discovered with no skill required (no wemos skill activated). Devices can be controlled. The Echo FW version is 591448720.
The second generation Echo does not seem to be able to control or discover the devices with the latest Fw that was released today.
Looks like Amazon is really messing up big time with the second generation Echo (sound is way worse than with the old one - now this).
Let´s see if Amazon fixes that or if the kill my old Echo for this by updating it´s FW as well ...

@sciencegirl100
Copy link
Author

maybe someone just needs to make a smart home skill for the ESP8266. I might give it a shot, but no guarantees.

@arnowillig
Copy link

@MacSass Same here, 2nd gen. Echo does not finde the devices, Echo FW version is 592452720.
However, the echo DOES send HTTP requests (GET to /setup.xml and /eventservice.xml and POST to /upnp/control/basicevent1).
POST body is this:
<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>

I think the echo tries to read the current state of the emulated WeMo switch, but then fails to enumerate the device. :-(

Anyone a solution yet?
akw

@kakopappa
Copy link
Owner

hello @MacSass @arnowillig @sciencedude100 @Braandn

Thank you for your input guys

I have added GetBinaryState support to single switch version. Can you guys test it and let me know. I have an Eco at home. It does not send GetBinaryState

https://gist.github.com/kakopappa/02299a8ceec0aaaad3ea3bd7f2af8066

@ma7gdp
Copy link

ma7gdp commented Nov 26, 2017

I just tried the code you have on a "WemosD1 mini" and the echo dot 2nd gen is still reports "No new devices found". The serial on the WemosD1 is outputting the usual though:

Sending response to 192.168.1.74
Port : 50000
Response sent !
192.168.1.74, port 50000
192.168.1.74, port 50000
########## Responding to setup.xml ... ########

Sending :urn:Belkin:device:controllee:1boxBelkin International Inc.Socket3.1415Belkin Plugin Socket 1.0
uuid:Socket-1_0-38323636-4558-4dda-9188-cda0e61957d9221517K01017690urn:Belkin:service:basicevent:1urn:Belkin:serviceId:basicevent1/upnp/control/basicevent1/upnp/event/basicevent1/eventservice.xml

########## Responding to setup.xml ... ########

Sending :urn:Belkin:device:controllee:1boxBelkin International Inc.Socket3.1415Belkin Plugin Socket 1.0
uuid:Socket-1_0-38323636-4558-4dda-9188-cda0e61957d9221517K01017690urn:Belkin:service:basicevent:1urn:Belkin:serviceId:basicevent1/upnp/control/basicevent1/upnp/event/basicevent1/eventservice.xml

@RootCNC
Copy link

RootCNC commented Dec 1, 2017

Same, doesn't work with Sonos One with Alexa built in- unable to discover devices =[ great project and keep up the good work! I will be following it!

@kakopappa
Copy link
Owner

@tommyfranke
Copy link

@kakopappa, thank's for the great work.
The above code works wonderful on my new Amazon Dot V2 with actual Firmware 595459620.
My Nodemcu was found at once, you don't need the Wemo-Skill!!!
Switching works fine.

Btw: It seems to me that the "eventservice.xml" never get called by Echo Dot, is it not needed?

@ZoMiGo
Copy link

ZoMiGo commented Dec 6, 2017

hi i have Amazon Dot V2 with actual Firmware 595459620 my problem is alexa dont found any devices.
i use https://gist.github.com/kakopappa/02299a8ceec0aaaad3ea3bd7f2af8066

@arnowillig
Copy link

arnowillig commented Dec 6, 2017 via email

@RootCNC
Copy link

RootCNC commented Dec 8, 2017

@kakopappa I've just ran the software now and unfortunately it doesn't seem to work. =[

I have gone into the Alexa app to see the version number and its not listed where amazon says it should, I was hoping this might help debug the problem.

I can see in the serial terminal Alexa is sending something to the ESP8266 but still doesnt discover any devices. =[

The Sonos one with Alexa does with the Wemo insight version perfectly so not too sure.

@sciencegirl100
Copy link
Author

This still isn't found on my Alexa V2 (Firmware: 597464620)

@MacSass
Copy link

MacSass commented Dec 17, 2017

Thanks for your work on this Kakopappa - I will try this latest version during the week, although I do not have too much hope looking at past responses.
I could provide some network trace if that helps if you let me know what you would need ...

@MacSass
Copy link

MacSass commented Dec 18, 2017

Hello, I have tried with the new script found here:
[https://gist.github.com/kakopappa/02299a8ceec0aaaad3ea3bd7f2af8066]
and can confirm that no devices are found with that script with the new generation Alexa devices (tried Echo v2 and Echo Plus).
Both - the old and the new script - do not show any reaction at all when I do a "discover" in the Alexa app if there is only a new generation Alexa doing the search.
Interesting fact:
As soon as I have one "old" Alexa device (Echo Dot in my case) in the same network then both scripts do find devices with no problem.
It looks like the new devices send out a different broadcast string, as I never see a response from the ESP with the new devices. I would have expected that this:

if(request.indexOf('M-SEARCH') > 0) {
        if(request.indexOf("urn:Belkin:device:**") > 0) {
            Serial.println("Responding to search request ...");
            respondToSearch();
        }
    }

get´s triggered - but it does not with the new device (ip ....28 in attached logs), only if an old device is in the network as well the ESP responds to the broadcast of the old device (ip ...24 in attached logs)

I have attached the output of the script for V2 device only and for combination of V2+V1 Alexa device.

I think the broadcast of the generations is different and the listening ESP never get´s triggered by the new device. Thus it seems to be needed to modify the trigger criteria?
If I find the time I will see if I can do a network trace to check what the difference in query broadcast of the two generations is, that should clarify things.

Regards - MacSass

New script - Echo Plus and Echo Dot.txt
New script - Echo Plus only.txt

@MacSass
Copy link

MacSass commented Dec 18, 2017

Hi,
I did a network trace and think I´m getting a little bit clearer on the issue:
While old devices send a SSDP broadcast containing "urn:Belkin:device:**" (which the ESP is looking for) the new devices send a SSDP broadcast with "upnp:rootdevice". Thus the ESP does never respond to the broadcast of the new Alexa devices.

When I do change the trigger that ESP is looking for to:

if(request.indexOf('M-SEARCH') > 0) {
if(request.indexOf("upnp:rootdevice") > 0) {
Serial.println("Responding to search request ...");
respondToSearch();
}
}

and also change the response string, then I can get the new device to discover the ESP!

I did an initial test and the script then seems to work fine for me. I have attached my modified script below and would appreciate any feedback, as I might not really fully understand what I´m doing :-)

irdevkit-macsass.txt

Regards - MacSass

@sciencegirl100
Copy link
Author

sciencegirl100 commented Dec 19, 2017

It Works!
Arduino Log
However, the repository's code doesn't work. Not sure why.
I ended up having to reset my Echo Dot V2 ( hold Mute & Vol - ).
Make sure the echo and esp8266 are on the same wireless. I've had issues with them on the same network, but on different APs.

EDIT:
Odd, I added in printing the request to terminal in the master branch and now it works.

kakopappa added a commit to kakopappa/arduino-esp8266-alexa-wemo-switch that referenced this issue Dec 19, 2017
@ma7gdp
Copy link

ma7gdp commented Dec 20, 2017

Is anyone else having an issue with getting this working? The serial output on my WemosD1mini shows activity when EchoDotV2 is discovering, but only ever shows "########## Responding to setup.xml ... ########" never the piece which @sciencedude100 shows in their Arduino log: "########## Responding to /upnp/control/basicevent1 ... ##########". It feels like it is almost there.

@MacSass
Copy link

MacSass commented Dec 20, 2017

Hello ma7gdp,
yes - I´m still having issues. As long as I only have my Echo Plus (new gen) in the network, devices still do NOT get discovered. I see requests for UDP Belkin in the log and responses being sent, but devices do not show up.
Also I do NOT see responses like "######### Responding to setup.xml ... ########".

As much as I can say this is caused by the fact that the response that get´s send currently is having:
"USN: uuid:" + persistent_uuid + "::urn:Belkin:device:**\r\n"
while the new gen devices expect a response of:
"USN: uuid:" + persistent_uuid + "::upnp:rootdevice\r\n"

I will verify my assumption in a minute, but I´m pretty confident because as soon as I add a 1st gen device (echo dot) to the network the discovery works fine (because 1st gen device is happy with the response).

Doing some more testing right now ...

@MacSass
Copy link

MacSass commented Dec 20, 2017

Hi again,
ok - I can confirm that this seems to be the root cause.
Changing
"USN: uuid:" + persistent_uuid + "::urn:Belkin:device:**\r\n" in switch.cpp to
"USN: uuid:" + persistent_uuid + "::upnp:rootdevice\r\n"
does allow to discover devices with 2nd generation Echos. Also it still works if only a 1st gen Echo is in the network - so this seems to be a solution as much as I can see.

After changing a devices state I do see continious responses to

Responding to /upnp/control/basicevent1 ...

about every 1 second. Not sure if those requests really happen or if this is another issue that should be looked at in a different thread / issue.

@ma7gdp
Copy link

ma7gdp commented Dec 21, 2017

Hey thanks @MacSass for taking a look. I only have Gen2 echo dot so cannot test the various combinations of scenarios with Gen1 etc. I can say though that even with the change to rootdevice in switch.cpp there are still no devices found by Alexa on the Gen2 dot. The serial output I get is as below (.97 is the Gen2 and the WemosD1mini is on .98). Still just "Responding to setup.xml" nothing else. Looks like the Gen2 is expecting a different response to the setup.xml request (assuming that the setup.xml request is Gen2 asking WemosD1mini to identify itself so Gen2 can list it via Alexa app).

btw... Thanks for taking the time. If only I had a Gen1 ... I probably would not have even noticed things weren't quite as they should be.

Udp multicast server started at 239.255.255.250:1900
WebServer started on port: 80
WebServer started on port: 81
Adding switches upnp broadcast responder
Adding switch : office lights index : 0
Adding switch : kitchen lights index : 1
Got UDP Belkin Request..

Sending response to 192.168.1.97
Port : 50000
Response sent !
########## Responding to setup.xml ... ########

Sending :urn:Belkin:device:controllee:1office lightsBelkin International Inc.Socket3.1415Belkin Plugin Socket 1.0
uuid:Socket-1_0-38323636-4558-4dda-9188-cda0e61957d9-80221517K01017690urn:Belkin:service:basicevent:1urn:Belkin:serviceId:basicevent1/upnp/control/basicevent1/upnp/event/basicevent1/eventservice.xml

@MacSass
Copy link

MacSass commented Dec 21, 2017

Hi ma7gdp,
I can get devices discovered with both, my Echo Dot (current version - whatever that is) and my "new" Echo Plus, depending on what I put into the switch.cpp. But I still have some issues with devices switching if only one of them is on the network.
Currently I´m not clear if devices are "linked" to a certain Echo if they are only linked to the account.
So I need to do more testing or additional network traces to get clarity on this.

So there definitely seems still something to be going on in what the devices expect as response for discovery and switching.
Fortunately the Christmas break is coming up and I should have some more time to look into this into more detail and do more testing.
I hope to have some more information / data in the upcoming days ... hopefully even before Christmas ...

@ma7gdp
Copy link

ma7gdp commented Dec 21, 2017

Great. No more work this year for me so happy to help out with any testing or traces at my end. Tricky part is understanding whats in the echo code without the original/working devices to "sniff". Cheers again.

@ma7gdp
Copy link

ma7gdp commented Dec 22, 2017

Picked up on your comment regarding the accounts. After lots of various testing I found issues with having a "household" Amazon account. Saying "Alexa switch accounts" and then "Alexa discover devices" did the trick. Not only did the Echo find the devices but it also allowed me to trigger them and the serial output of the WemosD1mini showed the catch of the event. Bottom line .... I can now trigger a relay by saying "Alexa switch office lights on" etc.. Thanks all. To confirm I have 2x latest EchoDots only on my network.

@kakopappa
Copy link
Owner

@AvisIoT @TetsudouSenpai

I have updated the website to show the device id now.

@MacSass
Copy link

MacSass commented Jan 28, 2018

Hi @AvisIoT ,
I already spoke to Kakopappa about adding device ID to sinric.com. I guess he will do that soon, also some more enhancements are planned.
Until then you can also use the attached code to:

  • Control more than one device
  • Get deviceID for devices
    If the attached code (rename to .ino) receives a request for an unknown device it will put out the deviceID in the serial console.

What you need to do:
Add your api an wifi credentials to the attached code. Create device on sinric and have it discovered by alexa. Issue command through alexa and you will see the deviceID in the serial console.

You can then replace the existing dummy device IDs in the code with your correct ones ...

As said Kokopappa will make more enhancements soon to make it easier - I guess.

Regards - MacSass

switch_multi_sinric.txt

@MacSass
Copy link

MacSass commented Jan 28, 2018

Uhhhh - He has been faster than me :-)

  • still my code might be useful for some that want to control multiple devices ...

@AvisIoT
Copy link

AvisIoT commented Jan 28, 2018

Thank you @kakopappa and @MacSass . I will test/experiment more next weekend. Have ordered few relay modules, once they arrive will put this to real life use... the multi-device code will be really useful in that case. @kakopappa also looking forward to update on issue #10 (kakopappa/sinric#10)

@RanTalbott
Copy link

To add some useful, but also some confusing, information.

I had some trouble getting Alexa to discover one of my experiments until I made the change that MacSass suggested. Thank you for that.

But...

  1. It also discovered one that didn't have the change.

  2. The Dot told me that it hadn't discovered anything. The Android app revealed that it had.

  3. The new experiment has 7 switches. Only the last 3 were discovered. I tweaked the debug code a little bit, and confirmed that initial responses for all 7 were sent. But the Dot is only asking for setup.xml for those last three. I'll post more about this after I do some more investigating.

@charles
Copy link

charles commented Feb 5, 2018

My echo dot stop find my devices after updated my apple time capsule from version 7.7.8 to 7.7.9. After that I try every possible solution here with no success. My solution was a downgrade to 7.7.8.

I hope that helps someone.

@LiamFatz
Copy link

LiamFatz commented Mar 3, 2018

@kakopappa
You're a legend. This resolved the issue for me.
Location - Ireland
Devices - Echo Gen 2 & nodeMCU
Your website is very clean & user-friendly. Simple to add multiple devices.
Thanks

@tollermine
Copy link

My Echo Dots where not able to finde anything... this fixed it for me:

if(request.indexOf('M-SEARCH') >= 0) { //if(request.indexOf("urn:Belkin:device:**") > 0) { if((request.indexOf("upnp:rootdevice") >= 0) || (request.indexOf("urn:Belkin:device:**") >= 0) || (request.indexOf("_urn:Belkin:device:_**") >= 0)) { Serial.println("Responding to search request ..."); respondToSearch(); } }

@hinkey247
Copy link

Hi / Thank you kakopappa finally got this system working - ok 2 relays can be detected and used with Alexa 2nd Gen and NodeMCU, but how to add more switches? I have added one but cannot be discovered. Many Thanks - Hinkey :)

@hinkey247
Copy link

Sorry guys just realised i hadn't given new port :) Works 100%

@santosh09142
Copy link

santosh09142 commented May 6, 2018

Hi, I am new for IOT techno. I am using NodeMcu 1.0 ESP8266 12E. with Alexa plus FW:608490620. I tried kakopappa latest code and in serial monitor some transaction is happing about setup.xml. but still alexa is not discovering.

Please let me

@kakopappa
Copy link
Owner

kakopappa commented May 6, 2018 via email

@santosh09142
Copy link

Thanks kakopappa, for fast reply, I did created switch object on sinric app and tried to search from Alexa app, App. found that object, but when i trigger switch on/off nothing happening on relay as will as on serial monitor.

i have added to replaypin in your script.

@hinkey247
Copy link

Could it be not assigning new port for relay switch device?

@kakopappa
Copy link
Owner

kakopappa commented May 6, 2018 via email

@santosh09142
Copy link

no i didnt see any activity trigger on/off activity on serial monitor.

@santosh09142
Copy link

santosh09142 commented May 6, 2018 via email

@hinkey247
Copy link

The port number in your source code for the router device number. Ie port port 80.

@santosh09142
Copy link

santosh09142 commented May 6, 2018 via email

@santosh09142
Copy link

santosh09142 commented May 7, 2018

Hi,
I am attaching trigger script which was working after some modification, stated above.

one more question :
for single trigger script i have not used any skill, but for this we are using "sinric" ?

myTest.txt

@Hyperpalette
Copy link

Isn’t Synric another AWS like (public cloud server)?

@Hyperpalette
Copy link

And if it is, is it not much different than Ewelink?

MarvAmBass added a commit to MarvAmBass/fauxmo that referenced this issue Sep 7, 2018
n8henrie/fauxmo#38 (comment)

kakopappa/arduino-esp8266-alexa-multiple-wemo-switch#22 (comment)

@n8henrie -- To answer your question: The fauxmo devices don't show up in the app after discovery is complete. I currently have several devices including real hardware that all work fine.

--However--
Based on @ertgtct suggestion I did some experimentation and now I can find the devices on discovery. Specifically I changed the response in the function "respond_to_search" from:

        response = '\n'.join([
            'HTTP/1.1 200 OK',
            'CACHE-CONTROL: max-age=86400',
            f'DATE: {date_str}',
            'EXT:',
            f'LOCATION: {location}',
            'OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01',
            f'01-NLS: {uuid.uuid4()}',
            'SERVER: Fauxmo, UPnP/1.0, Unspecified',
            'ST: urn:Belkin:device:**',
            f'USN: uuid:Socket-1_0-{serial}::upnp:rootdevice',
            ]) + '\n\n'
To:

        response = '\n'.join([
            'HTTP/1.1 200 OK',
            'CACHE-CONTROL: max-age=86400',
            f'DATE: {date_str}',
            'EXT:',
            f'LOCATION: {location}',
            'OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01',
            f'01-NLS: {uuid.uuid4()}',
            'SERVER: Fauxmo, UPnP/1.0, Unspecified',
            'ST: ::upnp:rootdevice',
            f'USN: uuid:Socket-1_0-{serial}::upnp:rootdevice',
            ]) + '\n\n'`
(the change is the ST: clause)

As yet I haven't managed to get the devices working but I suspect that's more to do with my environment rather than the fauxmo code. I've attached the log from a successful discovery, I don't know if you can spot where the change has made a difference. I'll continue testing and report back when I have a fully functioning system.

log06.txt

Thanks.
@lackdaz
Copy link

lackdaz commented Sep 19, 2018

Picked up on your comment regarding the accounts. After lots of various testing I found issues with having a "household" Amazon account. Saying "Alexa switch accounts" and then "Alexa discover devices" did the trick. Not only did the Echo find the devices but it also allowed me to trigger them and the serial output of the WemosD1mini showed the catch of the event. Bottom line .... I can now trigger a relay by saying "Alexa switch office lights on" etc.. Thanks all. To confirm I have 2x latest EchoDots only on my network.

After scouring most of the forums. This was my fix!!!

@santosh09142
Copy link

Hi lacdaz,

Can you elaborate more on this topic . Because I can see script work for 4 device and not more then that.

@lackdaz
Copy link

lackdaz commented Sep 19, 2018

Hi lacdaz,

Can you elaborate more on this topic . Because I can see script work for 4 device and not more then that.

Hey buddy, just check out the sinric that @kakopappa authored as well.

There is much less bloat in the code and its just a simpler implementation than this one you are attempting. Yes, you need to link the sinric skill.

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