GithubHelp home page GithubHelp logo

kakopappa / arduino-esp8266-alexa-multiple-wemo-switch Goto Github PK

View Code? Open in Web Editor NEW
308.0 70.0 196.0 27 KB

multiple belkin wemos switch emulator using ESP8266

Home Page: https://sinric.pro

License: MIT License

C++ 99.12% C 0.88%

arduino-esp8266-alexa-multiple-wemo-switch's Introduction

Arduino Esp8266 Alexa Multiple Belkin wemo switch emulator

If you have issues discovering please consider using Sinric Pro smart home skill.

This project supports emulating upto 14 belkin wemo switches using 1 ESP 8266 chip.

Parts you need:

WeMos D1-mini ($4.00) http://www.aliexpress.com/store/product/D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/1331105_32529101036.html

How to use:

  1. Download the code
  2. Open wemos.ino in the Arduino editor.
  3. Change the WI-FI settings.
  4. Define switches and callbacks
  5. Flash
  6. Enjoy

Do you want to turn on / off your TV, AirCon (AC) using Amazon Alexa? Checkout my latest project https://irdevkit.com/

Previous post on single wemo switch https://github.com/kakopappa/arduino-esp8266-alexa-wemo-switch/edit/master/README.md

If you have issues discovering please consider using sinric smart home skill.

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

Looking for a Cheap DIY Alexa Light Bulb?

https://github.com/kakopappa/ble-light-bulb

Articles about the Wemos switch

Credits

Developed By

arduino-esp8266-alexa-multiple-wemo-switch's People

Contributors

kakopappa avatar totolehero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-esp8266-alexa-multiple-wemo-switch's Issues

Cannot add to Wemo app

I tried adding the emulated Wemo switch in Wemo Android app. But it did not work. Any ideas?

Exception (9): crashing

Anyone else having trouble with this crashing?

I'm using a nodemcu board, and randomly it will just crash and dump a load of stuff in the serial monitor.

Tried multiple boards with the same outcome.

I can't seem to install the stack decoder on my arduino IDE running windows, any help would be great.

Best regards

Strange issue with discovered devices

Hi,
My Echo Dot is able to find devices, reflects clearly in Alexa app and debug window. When i try calling for power on or off Alexa tells me sorry no device registered with this name for at least 2 out of 6 switches, sometimes more.

In case some device does not get registered in first search and i search again it registers correctly but either the switch last added or one or more switches added previously give that response.

Crash when more than 11 devices

Hi there
And thanks for a great code .... Compilation was working 1.st time with the onboard diodes.

One question ...... When i compile with 11 devices it goes ok every time....
(heres the connect log)

Connecting to WiFi
Connecting ......
Connected to WifiTestNet
IP address: 10.0.0.182
RSSI:-77
Begin multicast ..
Udp multicast server started at 239.255.255.250:1900
WebServer started on port: 80
WebServer started on port: 81
WebServer started on port: 82
WebServer started on port: 83
WebServer started on port: 84
WebServer started on port: 87
WebServer started on port: 88
WebServer started on port: 89
WebServer started on port: 90
WebServer started on port: 94
WebServer started on port: 95
Adding switches upnp broadcast responder
Adding switch : Samsung T.V. index : 0
Adding switch : T.V. Mute index : 1
Adding switch : T.V. Channel index : 2
Adding switch : T.V. sound index : 3
Adding switch : T.V. one index : 4
Adding switch : Amplifier index : 5
Adding switch : Amplifier sound index : 6
Adding switch : Amplifier aux index : 7
Adding switch : Amplifier tuner index : 8
Adding switch : Amplifier mute index : 9
Adding switch : VacuumCleaner index : 10

BUT
When I compile with 12 devices the witty esp8266 reboot every 10 second.
It connect to wifi... and the reboot after 5 sec.

When i compile with 13 devices the witty esp8266 won't connect to wifi
and roboot every 5 second.

Same goes with devices up to 14 and over. (I could really use 20)
(I have a 100uf over the 3.3V supply for stability)

Have you seen this issue before, or have any idea of what is going wrong ?
Thanks in advance.

Relay

Hi

I'm wanting to use the relay as a pulse relay. is there anyway to make the code switch the relay on for say 1 second and then back off again without confusing alexa?

Any help would be great.

Thanks

Unintended (emulated WeMo switch) activity if going to the Alexa Web App - Smart Home - Devices page

Sorry, you may have already addressed this issue. I will look at your advice in this thread #25

Kakopappa, I am using your WeMo switch emulated code as the base code for a solution I developed for people with limited mobility. I provide them with the ability to voice control their hospital beds, because for them there is no other alternative. Everything necessary to make this work is my time and money as part of a volunteer effort.

I noticed some undesirable behavior and I am wondering if this is something you also noticed and if you thought of a solution for it. (Nassir may have already contacted you regarding this, so sorry if this is duplicate)

In my solution, I have 4 WeMo emulated switches that control 4 movements of the bed. In my lab, when I discover devices I see those devices in the Devices webpage within the Amazon\Alexa web app. The issue is anytime I either open the Devices web page, or refresh the Devices web page, or click Discover in the Devices web page all 4 relays cycle on and off. The downside of this is unintended bed motion creating a possible safety issue.

Looking at the Serial Port log, I think I see the cause but I have not figured out what to do about it. Associated with the Unintended switch cycling is a GetBinaryState message that will happen when you simply open the Devices web page, or refresh the Devices web page, or click Discover on the Devices webpage . Associated with the desired switch activity is a SetBinaryState message. I contacted Amazon but don't see them doing anything about it. I also contacted WeMo just in case their engineering team had to deal with this already since testing with a physical WeMo switch does not exhibit this same behavior.

Here are some snippets from the serial port for a few scenarios -

This is what a Voice Command for Turn on relay 2 looks like: (This is desirable behavior)

########## Responding to /upnp/control/basicevent1 ... ##########
"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:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">1</u:SetBinaryState></s:Body></s:Envelope>

request:"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:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">1</u:SetBinaryState></s:Body></s:Envelope>
Got Turn on request
Switch 2 turn on ...

And here is what it looks like when you click discover new devices for the same switch even when the devices are known and online (Undesirable)

request:"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">1</u:GetBinaryState></s:Body></s:Envelope>
Got Turn on request
Switch 2 turn on ...########## Responding to /upnp/control/basicevent1 ... ##########
"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">1</u:GetBinaryState></s:Body></s:Envelope>

And this is what it looks like if you simply refresh the Devices page in the Amazon\Alexa webpage under Smart Home (Undesirable)

request:"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">1</u:GetBinaryState></s:Body></s:Envelope>
Got Turn on request
Switch 2 turn on ...########## Responding to /upnp/control/basicevent1 ... ##########
"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">1</u:GetBinaryState></s:Body></s:Envelope>

Discovery change?

I was tweaking a branch of this code last night when suddenly Alexa stopped discovering the device. She won’t discover or control my garage door now either which has been running perfectly stably for several weeks. Discovers other skill changes (like sinric). Did amazon change something 12 hrs ago?
I haven’t switched debug messages on to narrow the problem down yet...

Alexa won't find more than 5 switches...

If I define more than 5 switches, Alexa randomly fails to discover some of them. All the switches I have defined work fine idenpendanty, but discovery of all of them is a problem. The code says "max 10" - what limit is this, and have I hit it early?

Basic lack of understanding. GPIO 0 until GPIO 8.

It lies hidden in my mind, as I can address the "WeMos D1 mini" PIN D0 to D8 in the example wemos.ini to perform switching functions.
Since 3 days, after the purchase of an Amazon Echo Dot, I now deal with the topic of signal exchange.
At Sinric.com I opened an account and defined a switch. I got the sketch wemos.ini running on the "WeMos D1 mini" and Alexa recognizes the two switches specified in the example. When I talk to Alexa I can see in the monitor that the two switches are also switched on or off.
Only which PIN of the "WeMos D1 mini" is behind it? Nothing happens at the exits. In the sketch I also find no definition of an OUTPUT. Have I overlooked something fundamental?

Not an issue......multiple wemo with dynamic wifi credentials and socket configurations

Dear bro...

i ve used your source code of multiple wemo and added android ap code for configuring wifi name pass code and also to configure switches dynamically..

here is the brief description of code i ve developed

  1. Waits for wifi connection during attempt GPIO blinks every 1 sec untill 60sec (60sec because if power failure then my wifi router takes around 50sec to restore with good wifi (i beleive it is same in most cases))

  2. if connection is unsuccessful after 60seconds then GPIO permanently goes off and ap mode auto starts, as shown in below figure

    untitled

  3. now take your mobile and trun on wifi and connect to the name "BUBBLES".. refer screenshot below
    screenshot_2018-02-17-18-21-17-705_com android settings

  4. connect to ip as mentioned in 2nd step uart log. the mobile screen will look like below
    mobile

  5. and "Submit" thats it.. wifi id and password will be saved in EEPROM and everything will work fine..

  6. when power reset wifi will get auto connected with ID and password read from EEPROM of ESP8266. and GPIO will be on continuously when wifi is connected "symbol of successful wifi connection"

  7. if you dont want 5 smart switches then leave blank "configure socket name text box". if you leave blanck then switch will not be configured anymore.

Enjoy the code (cheers to kakopappa) - if you want to buy a beer buy for him... 👍

`
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include
#include "switch.h"
#include "UpnpBroadcastResponder.h"
#include "CallbackFunction.h"

// --------- ap mode -----------
#include <ESP8266mDNS.h>
#include <EEPROM.h>

MDNSResponder mdns;
ESP8266WebServer server(80);

const char* ssid = "BUBBLES";
const char* passphrase = "BUBBLES";
String st;
String content;

// end ap mode------------

// prototypes
boolean connectWifi();

//on/off callbacks 
bool socket_1_on();
bool socket_1_off();
bool socket_2_on();
bool socket_2_off();
bool socket_3_on();
bool socket_3_off();
bool socket_4_on();
bool socket_4_off();
bool socket_5_on();
bool socket_5_off();

bool soc_1_configured= false; 
bool soc_2_configured= false; 
bool soc_3_configured= false; 
bool soc_4_configured= false; 
bool soc_5_configured= false; 

// Change this before you flash
const char* wemo_ssid = "FCI_BB_NAV";
const char* wemo_password = "voohanaveen@voohanaveen";

//---- declare io pin -------------
const int relayPin = 2;
//---- end declare io pin -------------

int icount = 0;
boolean wifiConnected = false;

UpnpBroadcastResponder upnpBroadcastResponder;

Switch *socket1 = NULL;
Switch *socket2 = NULL;
Switch *socket3 = NULL;
Switch *socket4 = NULL;
Switch *socket5 = NULL;

bool is_socket_1_on = false;
bool is_socket_2_on = false;
bool is_socket_3_on = false;
bool is_socket_4_on = false;
bool is_socket_5_on = false;

//--- switch names ------------
String socket_1_name="";
String socket_2_name="";
String socket_3_name="";
String socket_4_name="";
String socket_5_name="";

//--- end of switch names ------------

void setup()
{
  Serial.begin(115200);
  
  // Setup Relay
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, LOW); 
  icount = 0;
  //---------- read ssid and pass ----------------
	  EEPROM.begin(512);
	  delay(10);
	  Serial.println();
	  Serial.println();
	  Serial.println("Startup");
	  // read eeprom for ssid and pass
	  Serial.println("Reading EEPROM ssid");
	  String esid;
	  for (int i = 0; i < 32; ++i)
		{
		  esid += char(EEPROM.read(i));
		}
	  Serial.print("SSID: ");
	  Serial.println(esid);
	  Serial.println("Reading EEPROM pass");
	  String epass = "";
	  for (int i = 32; i < 96; ++i)
		{
		  epass += char(EEPROM.read(i));
		}
	  Serial.print("PASS: ");
	  Serial.println(epass);  

	// -----------end read ssid and pass ---------------

  // ------- read each switch name and load --------------------
  // each switch name is limited to 20char
  String socket_name_x = "";
	Serial.println("Reading EEPROM device names");
	  socket_name_x = "";
	
  long fetch_eeprom_code = 100;
  //----------------------------------------------------------------
  for (long i = fetch_eeprom_code; i < fetch_eeprom_code + 20; ++i)
		{
		  socket_name_x += char(EEPROM.read(i));
		}
	Serial.print("soc 1: ");
	  Serial.println(socket_name_x);
	socket_1_name = socket_name_x.c_str();
  //----------------------------------------------------------------
  //----------------------------------------------------------------  
	fetch_eeprom_code += 20;
	  socket_name_x = "";      
  for (long i = fetch_eeprom_code; i < fetch_eeprom_code + 20; ++i)
		{
		  socket_name_x += char(EEPROM.read(i));
		}
	  Serial.print("soc 2: ");
	  Serial.println(socket_name_x); 
	socket_2_name = socket_name_x.c_str();  
  //----------------------------------------------------------------  
	fetch_eeprom_code += 20;
	  socket_name_x = "";      
  for (long i = fetch_eeprom_code; i < fetch_eeprom_code + 20; ++i)
		{
		  socket_name_x += char(EEPROM.read(i));
		}
	  Serial.print("soc 3: ");
	  Serial.println(socket_name_x);  
	socket_3_name = socket_name_x.c_str();
  //----------------------------------------------------------------  
  //----------------------------------------------------------------  
	fetch_eeprom_code += 20;
	  socket_name_x = "";      
  for (long i = fetch_eeprom_code; i < fetch_eeprom_code + 20; ++i)
		{
		  socket_name_x += char(EEPROM.read(i));
		}
	  Serial.print("soc 4: ");
	  Serial.println(socket_name_x);  
		socket_4_name = socket_name_x.c_str();
  //----------------------------------------------------------------  
  //----------------------------------------------------------------  
	fetch_eeprom_code += 20;
	  socket_name_x = "";      
  for (long i = fetch_eeprom_code; i < fetch_eeprom_code + 20; ++i)
		{
		  socket_name_x += char(EEPROM.read(i));
		}
	  Serial.print("soc 5: ");
	  Serial.println(socket_name_x);  
		socket_5_name = socket_name_x.c_str();
  //----------------------------------------------------------------  

  // ------- end read each switch name and load --------------------
  
	wemo_ssid = esid.c_str();
	wemo_password = epass.c_str();

  // Initialise wifi connection
  wifiConnected = connectWifi(); // uncomment this code in final execution
  //
  //wifiConnected = 0; // comment this line in fianl code
  
  if(wifiConnected){
	upnpBroadcastResponder.beginUdpMulticast();
	
	// Define your switches here. Max 10
	// Format: Alexa invocation name, local port no, on callback, off callback
	if(socket_1_name.length()>0)
  {
	socket1 = new Switch(socket_1_name, 80, socket_1_on, socket_1_off);
	soc_1_configured = true;
  }
  
  if(socket_2_name.length()>0)
  {
	socket2 = new Switch(socket_2_name, 81, socket_2_on, socket_2_off);
	soc_2_configured = true;
  }

  if(socket_3_name.length()>0)
  {
	socket3 = new Switch(socket_3_name, 82, socket_3_on, socket_3_off);
	soc_3_configured = true;
  }

  if(socket_4_name.length()>0)
  {
	socket4 = new Switch(socket_4_name, 83, socket_4_on, socket_4_off);
	soc_4_configured = true;
  }
  if(socket_5_name.length()>0)
  {
	socket5 = new Switch(socket_5_name, 84, socket_5_on, socket_5_off);
	soc_5_configured = true;
  }
  
  //socket1 = new Switch("socket1", 80, socket_2_on, socket_2_off);
  
	Serial.println("Adding switches upnp broadcast responder");
  if(soc_1_configured) { upnpBroadcastResponder.addDevice(*socket1); }
  if(soc_2_configured) { upnpBroadcastResponder.addDevice(*socket2); }
  if(soc_3_configured) { upnpBroadcastResponder.addDevice(*socket3); }
  if(soc_4_configured) { upnpBroadcastResponder.addDevice(*socket4); }
  if(soc_5_configured) { upnpBroadcastResponder.addDevice(*socket5); }  
  }
  //----- ap mode -----
	else
  {
	 setupAP();
  }
  //----- end ap mode -----
}
 
void loop()
{

   server.handleClient();
   if(wifiConnected){
	  digitalWrite(relayPin, HIGH);
	  upnpBroadcastResponder.serverLoop();
  if(soc_1_configured) {       socket1->serverLoop(); }
  if(soc_2_configured) {       socket2->serverLoop(); }
  if(soc_3_configured) {       socket3->serverLoop(); }
  if(soc_4_configured) {       socket4->serverLoop(); }
  if(soc_5_configured) {       socket5->serverLoop(); }
  }
}

bool socket_1_on() {
	Serial.println(socket_1_name);
  Serial.println("on");
	is_socket_1_on = true;    
	return is_socket_1_on;
}

bool socket_1_off() {
	Serial.println(socket_1_name);
  Serial.println("off");
	is_socket_1_on = false;
	return is_socket_1_on;
}

bool socket_2_on() {
	Serial.println(socket_2_name);
  Serial.println("on");
	is_socket_2_on = true;    
	return is_socket_2_on;
}

bool socket_2_off() {
	Serial.println(socket_2_name);
  Serial.println("off");
	is_socket_2_on = false;
	return is_socket_2_on;
}


bool socket_3_on() {
	Serial.println(socket_3_name);
  Serial.println("on");
	is_socket_3_on = true;    
	return is_socket_3_on;
}

bool socket_3_off() {
	Serial.println(socket_3_name);
  Serial.println("off");
	is_socket_3_on = false;
	return is_socket_3_on;
}


bool socket_4_on() {
	Serial.println(socket_4_name);
  Serial.println("on");
	is_socket_4_on = true;    
	return is_socket_4_on;
}

bool socket_4_off() {
	Serial.println(socket_4_name);
  Serial.println("off");
	is_socket_4_on = false;
	return is_socket_4_on;
}

bool socket_5_on() {
	Serial.println(socket_5_name);
  Serial.println("on");
	is_socket_5_on = true;    
	return is_socket_5_on;
}

bool socket_5_off() {
	Serial.println(socket_5_name);
  Serial.println("off");
	is_socket_5_on = false;
	return is_socket_5_on;
}


// connect to wifi – returns true if successful or false if not
boolean connectWifi(){
  boolean state = true;
  int i = 0;
  
  WiFi.mode(WIFI_STA);
  WiFi.begin(wemo_ssid, wemo_password);
  Serial.println("");
  Serial.println("Connecting to WiFi");

  // Wait for connection
///* //- un comment this untill serial print line connection failed
  Serial.print("Connecting ...");
  while (WiFi.status() != WL_CONNECTED) {
	delay(500);
	Serial.print(".");
	//--- status led code
	digitalWrite(relayPin, HIGH);
	delay(500);
	digitalWrite(relayPin, LOW);
	//--- end status led code
	
	if (i > 60){ // try 60 times - 1 min for initilization
	  state = false;
	  break;
	}
	i++;
  }
  
  if (state){
	Serial.println("");
	Serial.print("Connected to ");
	Serial.println(wemo_ssid);
	Serial.print("IP address: ");
	Serial.println(WiFi.localIP());
  }
  else {

  Serial.println("");
	Serial.println("Connection failed.");
  }
//*/ //- end un comment this untill serial print line connection failed
  //state = 0; // comment this in main code
  return state;
}

//------------------- ap mode code------------------------



void launchWeb(int webtype) {
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("Local IP: ");
  Serial.println(WiFi.localIP());
  Serial.print("SoftAP IP: ");
  Serial.println(WiFi.softAPIP());
  /*if (!mdns.begin("esp8266", WiFi.localIP())) {
	Serial.println("Error setting up MDNS responder!");
	while(1) { 
	  delay(1000);
	}
  }
  */
  Serial.println("mDNS responder started"); 
  createWebServer(webtype);
  // Start the server
  server.begin();
  Serial.println("Server started"); 
}


void setupAP(void) {
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);
  int n = WiFi.scanNetworks();
  Serial.println("scan done");
  if (n == 0)
	Serial.println("no networks found");
  else
  {
	Serial.print(n);
	Serial.println(" networks found");
	for (int i = 0; i < n; ++i)
	 {
	  // Print SSID and RSSI for each network found
	  Serial.print(i + 1);
	  Serial.print(": ");
	  Serial.print(WiFi.SSID(i));
	  Serial.print(" (");
	  Serial.print(WiFi.RSSI(i));
	  Serial.print(")");
	  Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
	  delay(10);
	 }
  }
  Serial.println(""); 
  st = "<ol>";
  for (int i = 0; i < n; ++i)
	{
	  // Print SSID and RSSI for each network found
	  st += "<li>";
	  st += WiFi.SSID(i);
	  st += " (";
	  st += WiFi.RSSI(i);
	  st += ")";
	  st += (WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*";
	  st += "</li>";
	}
  st += "</ol>";
  delay(100);
  WiFi.softAP(ssid);
  Serial.println("softap");
  launchWeb(1);
  Serial.println("over");
}


void createWebServer(int webtype)
{
  // Check for any mDNS queries and send responses
  mdns.update();
  
  if ( webtype == 1 ) {
	server.on("/", []() {
		IPAddress ip = WiFi.softAPIP();
		String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
		content = "<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
		content += ipStr;
		content += "<p>";
		content += st;
		content += "</p><form method='get' action='setting'><label>SSID: </label><input name='ssid' length=32><input name='pass' length=64>";
		content += "</p> <label>Configure socket 1 name ->: </label><input name='soc1' length=20>";
		content += "</p> <label>Configure socket 2 name ->: </label><input name='soc2' length=20>";
		content += "</p> <label>Configure socket 3 name ->: </label><input name='soc3' length=20>";        
		content += "</p> <label>Configure socket 4 name ->: </label><input name='soc4' length=20>";
		content += "</p> <label>Configure socket 5 name ->: </label><input name='soc5' length=20>";
	content += "</p> <input type='submit'></form>";
		content += "</html>";
		server.send(200, "text/html", content);  
	});
	server.on("/setting", []() {
		String qsid = server.arg("ssid");
		String qpass = server.arg("pass");
		
		String qsoc1 = server.arg("soc1");
		String qsoc2 = server.arg("soc2");
		String qsoc3 = server.arg("soc3");
		String qsoc4 = server.arg("soc4");
		String qsoc5 = server.arg("soc5");
	
		  Serial.println(qsoc1);
		  Serial.println(qsoc2);
		  Serial.println(qsoc3);
		  Serial.println(qsoc4);
		  Serial.println(qsoc5);
	
  boolean written_to_eeprom = false;
  
	if (qsid.length() > 0 && qpass.length() > 0) {
		  Serial.println("clearing eeprom");
		  for (int i = 0; i < 96; ++i) { EEPROM.write(i, 0); }
			
		  Serial.println("writing eeprom ssid:");
		  for (int i = 0; i < qsid.length(); ++i)
			{
			  EEPROM.write(i, qsid[i]);
			  Serial.print("Wrote: ");
			  Serial.println(qsid[i]); 
			}
		  Serial.println("writing eeprom pass:"); 
		  for (int i = 0; i < qpass.length(); ++i)
			{
			  EEPROM.write(32+i, qpass[i]);
			  Serial.print("Wrote: ");
			  Serial.println(qpass[i]); 
			}    
	  written_to_eeprom = true;
	}

  //------------- write config names into switches-----------------
  long eeprom_var_update = 100;
  if (qsoc1.length() > 0) {
		  for (long i = eeprom_var_update; i < eeprom_var_update + 20; ++i) { EEPROM.write(i, 0); }
		  
		  Serial.println("writing soc1 name:");
		  for (long i = 0; i < qsoc1.length(); ++i)
			{
			  EEPROM.write(i+eeprom_var_update, qsoc1[i]);
			  //Serial.print("Wrote: ");
			  //Serial.println(qsoc1[i]); 
			}
	  written_to_eeprom = true;
	}

  eeprom_var_update = 120;
  if (qsoc2.length() > 0) {
		  for (long i = eeprom_var_update; i < eeprom_var_update + 20; ++i) { EEPROM.write(i, 0); }
		  
		  Serial.println("writing soc2 name:");
		  for (long i = 0; i < qsoc2.length(); ++i)
			{
			  EEPROM.write(i+eeprom_var_update, qsoc2[i]);
			  //Serial.print("Wrote: ");
			  //Serial.println(qsoc2[i]); 
			}
	  written_to_eeprom = true;
	}

  eeprom_var_update = 140;
  if (qsoc3.length() > 0) {
		  for (long i = eeprom_var_update; i < eeprom_var_update + 20; ++i) { EEPROM.write(i, 0); }
		  
		  Serial.println("writing soc3 name:");
		  for (long i = 0; i < qsoc3.length(); ++i)
			{
			  EEPROM.write(i+eeprom_var_update, qsoc3[i]);
			  //Serial.print("Wrote: ");
			  //Serial.println(qsoc3[i]); 
			}
	  written_to_eeprom = true;
	}

	eeprom_var_update = 160;
  if (qsoc4.length() > 0) {
		  for (long i = eeprom_var_update; i < eeprom_var_update + 20; ++i) { EEPROM.write(i, 0); }
		  
		  Serial.println("writing soc4 name:");
		  for (long i = 0; i < qsoc4.length(); ++i)
			{
			  EEPROM.write(i+eeprom_var_update, qsoc4[i]);
			  //Serial.print("Wrote: ");
			  //Serial.println(qsoc4[i]); 
			}
	  written_to_eeprom = true;
	}

	  eeprom_var_update = 180;
  if (qsoc5.length() > 0) {
		  for (long i = eeprom_var_update; i < eeprom_var_update + 20; ++i) { EEPROM.write(i, 0); }
		  
		  Serial.println("writing soc5 name:");
		  for (long i = 0; i < qsoc5.length(); ++i)
			{
			  EEPROM.write(i+eeprom_var_update, qsoc5[i]);
			}
	  written_to_eeprom = true;
	}
  

//------------- end write config names into switches-----------------
	if (written_to_eeprom == true) {
	  EEPROM.commit();
	  content = "<!DOCTYPE HTML>\r\n<html>";
	  content += "<p>saved to eeprom... reset to boot into new wifi</p></html>";
	}
	else {
		  content = "Error";
		  Serial.println("Sending 404");
		}
		server.send(200, "text/html", content);
	});
  } else {
	server.on("/", []() {
	  server.send(200, "text/plain", "this works as well");
	});
	server.on("/setting", []() {
	  server.send(200, "text/plain", "setting.");
	});
	server.on("/cleareeprom", []() {
	  content = "<!DOCTYPE HTML>\r\n<html>";
	  content += "<p>Clearing the EEPROM</p></html>";
	  server.send(200, "text/html", content);
	  Serial.println("clearing eeprom");
	  for (int i = 0; i < 96; ++i) { EEPROM.write(i, 0); }
	  EEPROM.commit();
	});
  }
}

//------------------- end ap mode code------------------------

`

i hope the code is useful.... cheers kakopappa.... please include my code in your repositories if you are interested......

Error when Compling

Hi please let me know if the following error after compiling is normal and can be overlooked.

sketch\UpnpBroadcastResponder.cpp:70:22: warning: character constant too long for its type [enabled by default]

if(request.indexOf('M-SEARCH') > 0) {

                  ^

sketch\UpnpBroadcastResponder.cpp: In member function 'void UpnpBroadcastResponder::serverLoop()':

sketch\UpnpBroadcastResponder.cpp:70:32: warning: large integer implicitly truncated to unsigned type [-Woverflow]

if(request.indexOf('M-SEARCH') > 0) {

                            ^

Sketch uses 249541 bytes (57%) of program storage space. Maximum is 434160 bytes.
Global variables use 37676 bytes (45%) of dynamic memory, leaving 44244 bytes for local variables. Maximum is 81920 bytes.

Exception (9)

Got this working on my NodeMCU v2 ESP 12-E module but every so often I get an Exception and the NodeMCU crashes.

here is the stack trace

Exception (9):
epc1=0x40202047 epc2=0x00000000 epc3=0x00000000 excvaddr=0x73626577 depc=0x00000000

ctx: cont 
sp: 3fff07b0 end: 3fff0990 offset: 01a0

>>>stack>>>
3fff0950:  3fffdad0 00000000 3ffef7b0 3ffef968  
3fff0960:  3fffdad0 00000000 3ffef7b0 40202aec  
3fff0970:  3fffdad0 00000000 3ffef960 40206c10  
3fff0980:  feefeffe feefeffe 3ffef970 40100718  
<<<stack<<<
�⸮⸮P9��⸮⸮

here is the decoded stack trace

Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
Decoding 4 results
0x40202047: Switch::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/Switch.cpp line 36
0x40202aec: setup at /Users/BB/development/arduino-esp8266-alexa-multiple-wemo-switch/wemos/wemos.ino line 50
0x40206c10: __yield at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/cont.S line 109

Also get this one sometimes as well


Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
Decoding 33 results
0x401050f1: ets_timer_disarm at ?? line ?
0x4020cd47: pm_post at ?? line ?
0x4021d4b2: system_get_os_print at ?? line ?
0x4021d65b: system_restart_local at ?? line ?
0x40201981: __wrap_system_restart_local at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_postmortem.c line 190
0x4010164a: pp_post at ?? line ?
0x40106afc: delayMicroseconds at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_wiring.c line 74
0x40201997: __wrap_system_restart_local at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_postmortem.c line 190
0x40201994: __wrap_system_restart_local at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_postmortem.c line 190
0x40104927: lmacRxDone at ?? line ?
0x401024ec: trc_NeedRTS at ?? line ?
0x40202047: Switch::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/Switch.cpp line 36
0x40103891: lmacProcessTXStartData at ?? line ?
0x40234830: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40202047: Switch::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/Switch.cpp line 36
0x4021c407: user_uart_wait_tx_fifo_empty at ?? line ?
0x40202047: Switch::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/Switch.cpp line 36
0x40104c27: wdt_feed at ?? line ?
0x40104c08: wdt_feed at ?? line ?
0x40202047: Switch::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/Switch.cpp line 36
0x40202047: Switch::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/Switch.cpp line 36
0x4020295c: loop at /Users/BB/development/arduino-esp8266-alexa-multiple-wemo-switch/wemos/wemos.ino line 58
0x4010020c: _umm_free at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1287
0x4020643c: String::changeBuffer(unsigned int) at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/WString.cpp line 519
0x4020648b: String::reserve(unsigned int) at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/WString.cpp line 519
0x4010020c: _umm_free at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1287
0x4010068c: free at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1733
0x402063e0: String::~String() at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/WString.cpp line 519
0x40202885: UpnpBroadcastResponder::serverLoop() at /var/folders/7s/dpy0prln67z0_gc91jrggncm0000gn/T/arduino_build_357420/sketch/UpnpBroadcastResponder.cpp line 84
0x40202954: loop at /Users/BB/development/arduino-esp8266-alexa-multiple-wemo-switch/wemos/wemos.ino line 56
0x40206bec: loop_wrapper at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at /Users/BB/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/cont.S line 109

Sometimes it re-initializes sometimes it doesn't. Any idea what this error means?

Seems related to #13

General info Request

First, thanks for producing some excellent pieces of software.
I run your single Wemo switch software on several esp devices - and it works Flawless!!
24 hours for a month and the esp8266 units and Alexa continue to work great.

Now, I was looking at your latest multiple wemo software and have a few questions:

Multiple wemo switch:

  1. I am not sure I understand how I use this. Your new software allows one to add several (14) device names and address but It is not clear to me how I would utilize it. On your single switch if i have a device name" box" and tell Alexa to turn box on/off and it does. I assign the output pin and it controls a relay or led etc... perfect!
    In the multiple switch I can add several(14) device names with each having a new name and port.
    If I were to tell Alexa the device name - say Turn on "Office" or Kitchen etc, What device and or pins does it control...

  2. I don't understand how the software controls each device output pin ? and where I put the info.

  3. There are several files beside the .ino file, where do I put these in order to have the ide compile?
    As is I get errors when trying to compile.

I guess I need a kick start to get me going on the project....

Thanks for your help

Joe

Switch

How can i add some switches to use without Alexa?

Works for a few minutes, then Alexa loses connection to device

I have successfully integrated this method into some of my existing Wemos code, and it works well. I have two devices connected to one Wemos, it boots up and connects to Wifi, I also have MQTT talking to a Pi, then the Alexa connection is successful. Alexa will function the devices on command, no problem. Then I leave and come back some time later, and find that while the Wemos is still connected to Wifi, Alexa no longer sees the devices.
I am about to look into just getting Alexa to connect to my Pi as one device and just relay commands from that server. Any ideas? I am implementing the code just like the example. Thanks in advance!

Using only one WebServer

Hi

First of all thanks for your effort to integrate our beloved ESP8266 "into Alexa framework"!
I integrated your code into my current project. Unfortunately I ran out of heap using your files.
As I dont have an Echo yet I cannot try it for myself but I have a suggestion:
My Project already uses a WebServer, so I dont think that It is necessary to start some more for every device. Wouldn't it be easier to respond to the UDP Broadcast (respondToSearch) with a different URL depending on the number of the device: for example:

"LOCATION: http://" + String(s) + ":" + String(localPort) + "/setup1.xml\r\n"
"LOCATION: http://" + String(s) + ":" + String(localPort) + "/setup2.xml\r\n"
...

And for the callback registration:

server->on("/setup1.xml", [&]() {
    handleSetupXml1();
  });
server->on("/setup2.xml", [&]() {
    handleSetupXml2();
  });
...

And for the events:

"<controlURL>/upnp/control/basicevent1</controlURL>"
"<controlURL>/upnp/control/basicevent2</controlURL>"
...

 server->on("/upnp/control/basicevent1", [&]() {
    handleUpnpControl1();
  });
 server->on("/upnp/control/basicevent2", [&]() {
    handleUpnpControl2();
  });

With some little adaptions for handling the number of course, but you get the idea.

Would this work or does the Belkin skill only accept setup.xml, /upnp/control/basicevent1 and nothing else ??

regards
Erich

,rst cause:4, boot mode:(1,7)

Hi, i flashed two ESP12, but once the flashing finish, it doesn't connect to the router, and in the serial monitor show the message: ,rst cause:4, boot mode:(1,7)
and if i rst the module, get this bucle:
**ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x0f
csum 0x0f
~ld**

does anyone had this issue?

thanks

Does hot handle GetBinaryState message

The Alexa app allows control of devices. It sends a GetBinaryState message to find the current status. This is erroneously interpreted as a switch ON command. Please add handler for GetBinaryState messages. Format of request is same as SetBinaryState message.

light dim and brighter

hello sir,
thanks for sharing cording,
is possible to make light dim and brighter with this cord,

and this cording working with arduino uno or maga ????

All Lights On instead of Off and Off instead of ON

Hi Guys,

I got everything to compile and work except the initial status of the relay board lights is ON and when I ask alexa to turn each one ON then the on board lights goes off, So everything is backwards. I tried 2 different relays, any help appreciated.

Here is my code:

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include
#include "switch.h"
#include "UpnpBroadcastResponder.h"
#include "CallbackFunction.h"

const int relayS1Pin = D1;
const int relayS2Pin = D2;
const int relayS3Pin = D3;
const int relayS4Pin = D5;

// prototypes
boolean connectWifi();

//on/off callbacks
void relayS1On();
void relayS1Off();
void relayS2On();
void relayS2Off();
void relayS3On();
void relayS3Off();
void relayS4On();
void relayS4Off();

// Change this before you flash
const char* ssid = "MyWiFiName";
const char* password = "********";

boolean wifiConnected = false;

UpnpBroadcastResponder upnpBroadcastResponder;

Switch *relayS1 = NULL;
Switch *relayS2 = NULL;
Switch *relayS3 = NULL;
Switch *relayS4 = NULL;

void setup()
{
Serial.begin(9600);

// Initialise wifi connection
wifiConnected = connectWifi();

if(wifiConnected){
upnpBroadcastResponder.beginUdpMulticast();

pinMode(relayS1Pin, OUTPUT);
pinMode(relayS2Pin, OUTPUT);
pinMode(relayS3Pin, OUTPUT);
pinMode(relayS4Pin, OUTPUT);

// Define your switches here. Max 14
// Format: Alexa invocation name, local port no, on callback, off callback
relayS1 = new Switch("office lights", 80, relayS1On, relayS1Off);
relayS2 = new Switch("bedroom lights", 81, relayS2On, relayS2Off);
relayS3 = new Switch("hallway lights", 82, relayS3On, relayS3Off);
relayS4 = new Switch("bathroom lights", 83, relayS4On, relayS4Off);

Serial.println("Adding switches upnp broadcast responder");
upnpBroadcastResponder.addDevice(*relayS1);
upnpBroadcastResponder.addDevice(*relayS2);
upnpBroadcastResponder.addDevice(*relayS3);
upnpBroadcastResponder.addDevice(*relayS4);
}
}

void loop()
{
if(wifiConnected){
upnpBroadcastResponder.serverLoop();

relayS1->serverLoop();
relayS2->serverLoop();
relayS3->serverLoop();
relayS4->serverLoop();
}
}

void relayS1On() {
digitalWrite(relayS1Pin, HIGH); // turn on relay with voltage HIGH
}

void relayS1Off() {
digitalWrite(relayS1Pin, LOW); // turn off relay with voltage HIGH
}

void relayS2On() {
digitalWrite(relayS2Pin, HIGH); // turn on relay with voltage HIGH
}

void relayS2Off() {
digitalWrite(relayS2Pin, LOW); // turn off relay with voltage HIGH
}

void relayS3On() {
digitalWrite(relayS3Pin, HIGH); // turn on relay with voltage HIGH
}

void relayS3Off() {
digitalWrite(relayS3Pin, LOW); // turn off relay with voltage HIGH
}
void relayS4On() {
digitalWrite(relayS4Pin, HIGH); // turn on relay with voltage HIGH
}

void relayS4Off() {
digitalWrite(relayS4Pin, LOW); // turn off relay with voltage HIGH
}

// connect to wifi – returns true if successful or false if not
boolean connectWifi(){
boolean state = true;
int i = 0;

WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.println("");
Serial.println("Connecting to WiFi");

// Wait for connection
Serial.print("Connecting ...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if (i > 10){
state = false;
break;
}
i++;
}

if (state){
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
else {
Serial.println("");
Serial.println("Connection failed.");
}

return state;
}

Relevant Alexa bug? Discovery problems...

This may be root the cause of my Alexa not finding >5 switches yesterday .

After a few hours of quite intensive device discovery, my Alexa stopped finding any new devices . I could see XML being uploaded from the multiple switch code when the discovery was underway , but Alexa app didn’t display any result. Put the code onto a new esp-01 with the same result.
In desperation I reset the echo speaker and tried discovery again. Alexa then had 2 copies of each switch ! Looks like discovery was happening all along , but that the results weren’t being saved somewhere.

boot error

As mentioned code is working fine but i'm getting this type of error in serial monitor
Board used: NODEMCU ESP8266-12F
screen shot 2016-12-20 at 5 58 38 pm

Device appears to be malfuctioning.

Hi! I have an amazon echo gen 2 and I was using this code with an esp for my light. Everything was working quite good but after each succesfull command Alexa was late responding Ok (or "I'm not sure what went wrong" although nothing went wrong!!!).

Yesterday the firmware of Alexa was updated to 599472520. The commands are still successful issued and the relay opens and closes as it is supposed but most of the times the always late response is "this device appears to be malfunctioning".

So there is something wrong with the new firmware update and the status report that we send to Alexa.

Similar problem after the update I have with the espalexa code where when I set a light to off Alexa responds that this value is not supported by the device!!! Just before the update it worked perfectly...

ESP (NodeMCU) crashes when adding the 4th switch...

Hello!
First of all: thank you very much for sharing your code with us!!!
Unfortunately I'm facing a serious issue when adding my 4th swith to the code.
3x Switches are running very smooth, but after adding the 4th my ESP crashes with:

Exception (28):
epc1=0x40203bfb epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

Is it possible that there is an issue with heap consumption?
I'm starting with:
Adding switch : eins index : 0 => loop heap size: 21248
Adding switch : zwei index : 1 => loop heap size: 21296
Adding switch : drei index : 2 =>loop heap size: 21216

and once I enter the loop (): => ... loop heap size: 6584

Any idea what could cause that crash after adding the 4th switch?
BR
Martin

How to make the state returned to Alexa from another gpio pin.

Lots of success with this code today after changing the persistent_uuid line in switch.cpp as pointed out by others. That's really helpful guys, thanks.
My Alexa Plus is discovering the devices without any additional skills, and controlling the resulting relays just fine.

My use case is a garage door control, that wants 1 sec pulses to either open or close the door. I have modified the code in this repo to read a gpio input pin on the esp2866 that is connected to a switch so I know the state of the door. Simple then to gate the Alexa on and off commands via that garageDoorState Boolean to only produce a close pulse when the door is open and vice versa.

The only problem with this, is that Alexa doesn't know the actual state of the door, only the state of the door control relays , and as they are always short pulses, when I look at the belkin smart switch device display in Alexas list of devices, it's always off.

Where in the code could I make changes such that the state of the door is returned to Alexa instead of the state of the door controls? I would like to see those smart switch displays in Alexa say "on" when the door is open. (This could be really useful if I ever want to know remotely if I have left the door open)

I can see regular " got binary state request" messages in the serial monitor which is probably where I need to make changes, but I lack the understanding of exactly how...

Apart from the tweak above, and removing most of the debug messages to make life quieter, I haven't touched the library files (yet).

Malformed XML

eventservice.xml:
replace

...
"</serviceStateTable>"
"</action>"
"</scpd>\r\n"
"\r\n"

by

...
"</serviceStateTable>"
"</action>"
"</actionList>\r\n"
"\r\n"

arduino-esp8266-alexa-multiple-wemo-switch

hi, i am trying to either add a new switch or rename an existing switch, however whatever i try, the code refuses to compile, and jut returns an undefined reference to the item i m trying to add/alter!

i dont have issues with switching the devices already added, i just want to customise it to my requirements.

please any help would be greatly received, and stop me from actually going insane!!

thank you in advance

Not an issue - a question

New to the esp2866, and to alexa , but keen to learn a bit about both by playing with an integration between the two.
My esp2866's are en route from china, and my brand new echo plus is awaiting something real to interface to.
Is anyone succefully using this code or similar to interface to alexa using just the Wemo skill? I won't be able to use sinric as it not a released skill in NZ. Also not keen on building the Home automation stack at present.
Thanks in advance.

Combining with WiFiManager library doesn't work

Hi!
I'm trying to combine your precious library with one built in Arduino called WiFiManager. It seems quite easy but whatever I do it doesn't want to work. My serial monitor ends on:
"Begin multicast ..
Udp multicast server started at 239.255.255.250:1900
WebServer started on port:
90
WebServer started on port:
91
Adding switches upnp broadcast responder
Adding switch : floor white index : 0
Adding switch : floor color index : 1"

And that's it. It won't respond to Alexa devices discovery. And I have no idea what is wrong, because without WiFiManager it works perfectly. But I need some easier way to configure WiFi parameters that uploading a sketch every time. So I would be very grateful if you could spend some time checking what might be wrong with combining those two libraries together. Is it something that I do wrong or is it some problem with libraries incompatibility?

My actual code looks like that:

// WiFiManager libraries
#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>          //https://github.com/tzapu/WiFiManager

// Alexa Wemos libraries
// #include <ESP8266WiFi.h>
// #include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include <functional>
#include "switch.h"
#include "UpnpBroadcastResponder.h"
#include "CallbackFunction.h"

// for manual config start
#define CONFIG_PIN 0

//for LED status
#include <Ticker.h>
Ticker led;

void Blink()
{
  //toggle state
  int state = digitalRead(BUILTIN_LED);  // get the current state of GPIO1 pin
  digitalWrite(BUILTIN_LED, !state);     // set pin to the opposite state
}
// LED status end

// Alexa wemo
// prototypes
boolean connectWifi();

//on/off callbacks
void floorwhiteOn();
void floorwhiteOff();
void floorColorOn();
void floorColorOff();

void floorWhiteOn() {
  digitalWrite(16, LOW);
  Serial.print("Switch 1 turn on ...");
}

void floorWhiteOff() {
  digitalWrite(5, HIGH);
  Serial.print("Switch 1 turn off ...");
}

void floorColorOn() {
  digitalWrite(5, LOW);
  Serial.print("Switch 2 turn on ...");
}

void floorColorOff() {
  digitalWrite(5,HIGH);
  Serial.print("Switch 2 turn off ...");
}

UpnpBroadcastResponder upnpBroadcastResponder;

Switch *floorwhite = NULL;
Switch *floorcolor = NULL;
// Alexa end

//gets called when WiFiManager enters configuration mode
void configModeCallback (WiFiManager *myWiFiManager) {
  Serial.println("Entered config mode");
  Serial.println(WiFi.softAPIP());
  //if you used auto generated SSID, print it
  Serial.println(myWiFiManager->getConfigPortalSSID());
  //entered config mode, make led toggle faster
  led.attach(0.2, Blink);
}

void setup() {
  
  Serial.begin(9600);
  pinMode(BUILTIN_LED, OUTPUT);
  pinMode(16, OUTPUT); // D0
  pinMode(5, OUTPUT); // D1
  pinMode(CONFIG_PIN, INPUT); // set pin 0 (D3) as input for setup mode
  
  // start ticker with 0.5 because we start in AP mode and try to connect
  led.attach(0.6, Blink);

  //WiFiManager
  //Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;
  //reset settings - for testing
  //wifiManager.resetSettings();

  //set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
  wifiManager.setAPCallback(configModeCallback);

  wifiManager.setConfigPortalTimeout(300); // 5 minutes timeout for setup mode

  //fetches ssid and pass and tries to connect
  //if it does not connect it starts an access point with the specified name
  //and goes into a blocking loop awaiting configuration
  if (!wifiManager.autoConnect("Enterius_Switch")) {
    Serial.println("failed to connect and hit timeout");
    //reset and try again, or maybe put it to deep sleep
    ESP.reset();
    delay(1000);
  }

  //if you get here you have connected to the WiFi
  Serial.println("connected...yeey :)");
  led.detach();
  //keep LED on
  digitalWrite(BUILTIN_LED, LOW);

  // Switches definitions
 
  upnpBroadcastResponder.beginUdpMulticast();

    // Define your switches here. Max 14
    // Format: Alexa invocation name, local port no, on callback, off callback
    floorwhite = new Switch("floor white", 90, floorWhiteOn, floorWhiteOff);
    floorcolor = new Switch("floor color", 91, floorColorOn, floorColorOff);

    Serial.println("Adding switches upnp broadcast responder");
    upnpBroadcastResponder.addDevice(*floorwhite);
    upnpBroadcastResponder.addDevice(*floorcolor);
 
}
  

void loop() {
 
   if ( digitalRead(CONFIG_PIN) == LOW ) {
    led.attach(0.2, Blink);
    //WiFiManager
    //Local intialization. Once its business is done, there is no need to keep it around
    WiFiManager wifiManager;
    wifiManager.startConfigPortal("Enterius_Switch");
    
    
    if (!wifiManager.startConfigPortal("Enterius_Switch")) {
      Serial.println("failed to connect and hit timeout");
      delay(3000);
      //reset and try again, or maybe put it to deep sleep
      ESP.reset();
      delay(5000);
}

}

// Main Alexa Wemos code


upnpBroadcastResponder.serverLoop();
    
    floorcolor->serverLoop();
    floorwhite->serverLoop();

    
  
}

I'm just a beginner so maybe I am making some stupid mistake? I spend a few last days on this and it seems that I can't solve this problem by myself. So please, please help.

Thanks and best regards
Chris

Dimmer Module

Is it possible to add a Dimmer Module to the system, so that you can say "Alexa set the light to 20%"
if yes, could you post an example?

Can you add eeprom- so that the switch state in the memory of ESP incase of blackout

Thanks for this nice work. It helps me a lot. I was using some RF based system in my home. Now I want to replace with ESP and Amazon Echo. In my earlier system I used EEPROM to keep switch state stored in the memory. I was trying to add same codes in your code to have same functionality. But it generates WDT RESET! ESP is continuously restarting. Please help with this.

An example
http://www.instructables.com/id/Home-Automation-With-Arduino-Buttons-LCD-EEPROM-AN/?ALLSTEPS

Alexa SmartHome skill - not finding

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 :/

What do these errors mean and how do I fix them

Arduino: 1.8.2 (Mac OS X), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, QIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

Archiving built core (caching) in: /var/folders/0s/tcclhfjs2p92xhrr0yd0ryx40000gn/T/arduino_cache_110302/core/core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_qio,UploadSpeed_115200,FlashSize_512K64,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____c705db4fc699f6463c021fb2c3716b5a.a
Sketch uses 249701 bytes (57%) of program storage space. Maximum is 434160 bytes.
Global variables use 37500 bytes (45%) of dynamic memory, leaving 44420 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

setup.xml not declared error

Hi,
I'm getting "Switch.cpp:214: error: 'setup_xml' was not declared in this scope" error when trying to compile. The fix is obvious (I think), but I just want to check if I've pulled down the right version which has the ability to respond to Alexa status requests. Or am I doing something stupid :-)

Thanks

unable to find devices

.
Connected to Ananth
IP address: 192.168.1.25
Begin multicast ..
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
request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E

B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: upnp:rootdevice
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::upnp:rootdevice

4299E

B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:service:Layer3Forwarding:1
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::urn:schemas-upnp-org:service:Layer3Forwarding:1

ce:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: upnp:rootdevice
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: ssdp:all
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

er"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: upnp:rootdevice
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: upnp:rootdevice
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: ssdp:all
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

er"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: upnp:rootdevice
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
MX: 3
ST: ssdp:all
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"

er"

1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

S: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

S: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

S: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

S: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

S: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

S: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E

B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: upnp:rootdevice
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::upnp:rootdevice

4299E

B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:service:Layer3Forwarding:1
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::urn:schemas-upnp-org:service:Layer3Forwarding:1

ce:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 1
ST: urn:dial-multiscreen-org:service:dial:1
USER-AGENT: Google Chrome/62.0.3202.89 Windows

.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 1
ST: urn:dial-multiscreen-org:service:dial:1
USER-AGENT: Google Chrome/62.0.3202.89 Windows

.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

ogle Chrome/62.0.3202.89 Windows

.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 1
ST: urn:dial-multiscreen-org:service:dial:1
USER-AGENT: Google Chrome/62.0.3202.89 Windows

.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

ogle Chrome/62.0.3202.89 Windows

.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Man: "ssdp:discover"
MX: 3

ogle Chrome/62.0.3202.89 Windows

.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:InternetGatewayDevice:1
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E

B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: upnp:rootdevice
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::upnp:rootdevice

4299E

B4299E::urn:schemas-upnp-org:device:InternetGatewayDevice:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:service:Layer3Forwarding:1
USN: uuid:D231DD98-C695-B6C7-BFDA-3F84B5B4299E::urn:schemas-upnp-org:service:Layer3Forwarding:1

ce:1

request : NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
Cache-Control: max-age=60
Location: http://192.168.1.1:1780/InternetGatewayDevice.xml
NTS: ssdp:alive
Server: POSIX, UPnP/1.0 linux/5.100.138.11
NT: urn:schemas-upnp-org:device:WANDevice:1
USN: uuid:C6D05FCA-D445-804C-AC3B-2337D607AF50::urn:schemas-upnp-org:device:WANDevice:1

Forwarding:1

ce:1

Please find above the request there is no urn for Belkin recevied. Please let me know what was the issue. I am trying with Echo Gen2

Problems running more than 1 instance of this code

I was trying to run 2 instances of this code, on seperate esp-01's so I could test the garage door controller I was building for a friend, whilst keeping my own garage door control going.

The esp-01's were doing dhcp so had unique ip addrees's, I renamed the Alexa invocation words so they were unique , and set the web ports so there was no overlap on the two devices , but I still couldn't make Alexa happy with both of them at the same time.
Eventually had to switch one of them off to get it stable.

Anyone hazard a guess why?

OTA flash

Alexa can't find the devices after an OTA "update". Can this be realised?

Question: WeMo Smart LED Bulbs

Hi
Thanks for a great piece of code...total cool, im using it everyday.

One question, do you plan to implement the WeMo Smart LED Bulbs ?
So it will be possible to dim the bulb, or set anything else to a certain value...volume, or channel up/down ?

Thanks in advance.

randomly disconnecting and reconnecting from wifi

great work with this, i use it almost everyday but the random blue flashing light is getting annoying. when left on for a min or two it spams the serial port with a bunch of random stuff then acts as if it reconnected to the wifi. i'm not sure if its really disconnecting and reconnecting or if its just a bug. it seams like the longer i leave it powered the more it spams.

Exception (0):
epc1=0x40227bc0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffdd0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff70:  60000600 3ffeefa8 3ffe9ea0 3ffe9ea0  
3fffff80:  4021d796 3fffdab0 00000000 3fffdcb0  
3fffff90:  3ffeefe8 00000000 3fff3b6c 4021d3bb  
3fffffa0:  40000f49 3fffdab0 3fffdab0 40000f49  
<<<stack<<<
c?ÇrSöfjø
Connecting to WiFi
Connecting ...
Exception (0):
epc1=0x402091a4 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffdd0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff70:  40209111 3fffdab0 00000000 00000000  
3fffff80:  3fff1b74 40208b3a 3fffdab0 00000000  
3fffff90:  3fffdcc0 3ffe9e20 00000000 40206f4f  
3fffffa0:  3ffe9e20 40000f49 3fffdab0 40000f49  
<<<stack<<<
c_GrSö2jø
Connecting to WiFi
Connecting ...
Exception (0):
epc1=0x402091a7 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffdd0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff70:  40209111 3fffdab0 00000000 00000000  
3fffff80:  3fff1b74 40208b3a 3fffdab0 00000000  
3fffff90:  3fffdcc0 3ffe9e20 00000000 40206f4f  
3fffffa0:  3ffe9e20 40000f49 3fffdab0 40000f49  
<<<stack<<<
c_Ç"Söfjø
Connecting to WiFi
Connecting ...
Exception (28):
epc1=0x40209218 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000024 depc=0x00000000

ctx: sys 
sp: 3ffffdd0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff70:  40209111 3fffdab0 00000000 00000000  
3fffff80:  3fff1b74 40208b3a 3fffdab0 00000000  
3fffff90:  3fffdcc0 3ffe9e20 00000004 40206f4f  
3fffffa0:  3ffe9e20 40000f49 3fffdab0 40000f49  
<<<stack<<<
c_ÇrSö&jø
Connecting to WiFi
Connecting ...
Exception (9):
epc1=0x402091a4 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000085 depc=0x00000000

ctx: sys 
sp: 3ffffdd0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff70:  40209111 3fffdab0 00000000 00000000  
3fffff80:  3fff1b74 40208b3a 3fffdab0 00000000  
3fffff90:  3fffdcc0 3ffe9e20 00000000 40206f4f  
3fffffa0:  3ffe9e20 40000f49 3fffdab0 40000f49  
<<<stack<<<
c_ÇrSö&jø
Connecting to WiFi
Connecting ...
Exception (0):
epc1=0x402091a7 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000085 depc=0x00000000

ctx: sys 
sp: 3ffffdd0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3fffff70:  40209111 3fffdab0 00000000 00000000  
3fffff80:  3fff1b74 40208b3a 3fffdab0 00000000  
3fffff90:  3fffdcc0 3ffe9e20 00000000 40206f4f  
3fffffa0:  3ffe9e20 40000f49 3fffdab0 40000f49  
<<<stack<<<
c_ÇrSöfjø
Connecting to WiFi
Connecting .........
Connected to Home

Wemos multi devices

Hi everyone I call Hasci and thanks for the great program is great. I use a Nodemcu 1.0 and I only have a problem: up to the fourth alexa device recognizes it as soon as I insert the 5th and 6th and 7th so until the alexa slide recognizes only the last 4 devices (example: if I use ports 80 -81-82-83-84-90-91) alexa only recognizes 83-84-90-91 always and only the last 4 devices. I wonder if it happened to you. thank you in advance.

After power cut off ,Alexa says devices not responding

Thanks kakopappa for source code, its working as charm.

After power cut off ,Alexa says devices not responding.
we have to ask Alexa to re discover every timer power off then only we are able to controls the devices.
Is there any fix for this? of workaround (obviously to ask Alexa to discover again) .
Can we send the Setup xml to Alexa with out request from it so that we dont need to ask for discover devices ?

wemo switch over LAN Shield

Hello! kakpopappa! First of all let me thank you for your great work on wemo and on sinric also. Wemo is the easyest way to connect with Alexa without any third party solution!
My problem is that I can't use this code to an Arduino Mega with LAN shield, only on a NODE MCU ESP8266. I need more IO ports than NODEMCU has, and LAN connection also. I prefer LAN connection...
Or it's possible to somehow port this code to use on an Arduino Uno or Mega with LAN shield?
Thank you very much!

Request/Question

Not an issue but wasnt sure how to comment, firstly great job!

Now to the request, is it possible to read the state of a pin using Alexa? for instance if this is connected to a gate and I'd like to know if the gate is open or closed by reading an input if it is high or low

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.