My project is a NodeMCU (8266), dual relay, but registering 9 devices D0..D8. 9 is for prototyping, and eventually will go to 2, or I'll add more I/O's. Naming of D0..D9 is better than naming after a specific device (Light, Fan...). Then in the Alexa app you can make groups to rename one or more devices for whatever you wish to use the component.
I setup a website along with the Alexa code to enable anyone to do a one time configuration of setting up the NodeMCU to connect to your home network and to remember the SSID and Password. So subsequent boots it would just join and it could be changed any time, anywhere, without recompiling the code. Then you could access the functionality from either alexa or a website. I want to be able to query sensors from outside my home and from Alexa. I intend to add Profiles so you can configure ten profiles and it would join whichever network has the strongest signal. Also I could add more fields to ask how many devices should I listen for and the active pins you used on your design.
My question then some details:
The WEMO examples posted show two devices that are binary ON, OFF. I would like to do multi layer query without using as many listeners. For example : Alexa set light to 50% would take LIGHT and 50% as variables. I could define D0 to be 50%LIGHT (one word), but that takes up one listener, and if I wanted 100 levels it would take 100 listeners. I should be able to do this with one listener.
Mods I made to code. I started with nassir-malik's, IOT-ESP8266-Alexa_Automation-master. First thing I did was remove the hard coded device names, and make one class that is instantiated upto 9 devices, with names of D0..D8. Those names link to output ports D0..D8.
Initially everything seemed to work, but not robustly. It would randomize the order it found the devices. And sometimes it would miss one or more during discovery. This was due to the nine listeners responding so quickly that it overloaded the Alexa. I found in the mdns spec that you must wait a random amount of time before responding to M-SEARCH. A 50 ms delay in responding to M-SEARCH, solved that problem.
Also I noticed the original code used a global array (packetBuffer) for the listeners. So it can't handle asynchronous calls. I isolated the buffers into each instance of the UpnpBroadcastResponder class. I have tested D0..D8 for 9 listeners. This uses 24% of the program space and 47% of memory.
Once it's done I will post the code, but I really would like it to support more than just ON/OFF. Has anyone solved that, or must I register my own skill ?
No answers so far. Time to dig into the SSDP spec to find out more about how Alexa discovers devices. And how to announce a device that is not binary. If anyone has a WEMO device and can install Wireshark to capture discovery, that would be very helpful.