Belkin Wemo emulator with ESP8266

This directory ESP8266 allows up to 14 switches Belkin WEMO using emulation. It is directly connected to Amazon Echo, Echo Show, Echo Dot or Echo Flex and can be controlled with voice instructions using Alexa.

Open the Arduino application and enter Wifi connection information in the following example and you can also change the names of the switches, this name will appear in the Alexa application.

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include "Switch.h"
#include "UpnpBroadcastResponder.h"

const char* ssid = "SSID";
const char* password = "Password";

const char* switchOneFriendlyName = "Switch One";
const char* switchTwoFriendlyName = "Switch Two";

Switch *switchOne = NULL;
Switch *switchTwo = NULL;

UpnpBroadcastResponder upnpBroadcastResponder;

void setup_wifi() 
{
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);
  }
}

bool switchOneOn()
{
  Serial.println("Switch One on");
  return true;
}

bool switchOneOff()
{
  Serial.println("Switch One off");
  return false;
}

bool switchTwoOn()
{
  Serial.println("Switch Two on");
  return true;
}

bool switchTwoOff()
{
  Serial.println("Switch Two off");
  return false;
}

void setup()
{
  Serial.begin(115200);
  setup_wifi();
  
  upnpBroadcastResponder.beginUdpMulticast();
  
  switchOne = new Switch(switchOneFriendlyName, 80, switchOneOn, switchOneOff);
  switchTwo = new Switch(switchTwoFriendlyName, 81, switchTwoOn, switchTwoOff);
  
  upnpBroadcastResponder.addDevice(*switchOne);
  upnpBroadcastResponder.addDevice(*switchTwo);
}

void loop()
{
  upnpBroadcastResponder.serverLoop();
  
  switchOne -> serverLoop();
  switchTwo -> serverLoop();
}
Wemo Smart Plug

Wemo Smart Plug 

Smart Outlet for Apple HomeKit

advertising

The ESP8266 Belkin Wemo Emulator Library is based on the work of Aruna Tennakoon . You can download it from the link below, writing to this serial port is commented out because in one of my projects it was confusing .

ESP8266BelkinWemoEmulator.zip

Here are some examples: ESP32, ESP8266, Arduino sketches, examples .