diff --git a/src/driver/drv_wemo.c b/src/driver/drv_wemo.c
index 7f7b1c994..1f30f112c 100644
--- a/src/driver/drv_wemo.c
+++ b/src/driver/drv_wemo.c
@@ -12,6 +12,13 @@
#include "drv_ssdp.h"
#include "../httpserver/new_http.h"
+// Wemo driver for Alexa, requiring btsimonh's SSDP to work
+// Based on Tasmota approach
+// The procedure is following:
+// 1. first MSEARCH over UDP is done
+// 2. then obk replies to MSEARCH with page details
+// 3. then alexa accesses our XML pages here with GET
+// 4. and can change the binary state (0 or 1) with POST
static const char *g_wemo_setup_1 =
""
@@ -134,6 +141,17 @@ const char *g_wemo_eventService =
""
""
"\r\n\r\n";
+const char *g_wemo_response_1 =
+""
+"";
+
+const char *g_wemo_response_2_fmt =
+""
+"%i"
+""
+""
+"\r\n";
+
static char *g_serial = 0;
static char *g_uid = 0;
static int outBufferLen = 0;
@@ -178,11 +196,59 @@ void WEMO_AppendInformationToHTTPIndexPage(http_request_t* request) {
stat_searchesReceived, stat_setupXMLVisits, stat_eventsReceived, stat_metaServiceXMLVisits, stat_eventServiceXMLVisits);
}
+
+
+bool Main_GetFirstPowerState() {
+ int i;
+ if (LED_IsLEDRunning()) {
+ return LED_GetEnableAll();
+ }
+ else {
+ // relays driver
+ for (i = 0; i < CHANNEL_MAX; i++) {
+ if (h_isChannelRelay(i) || CHANNEL_GetType(i) == ChType_Toggle) {
+ return CHANNEL_Get(i);
+ }
+ }
+ }
+ return 0;
+}
static int WEMO_BasicEvent1(http_request_t* request) {
const char* cmd = request->bodystart;
addLogAdv(LOG_INFO, LOG_FEATURE_HTTP, "Wemo post event %s", cmd);
+ // Sample event data taken by my user
+ /*
+ 1
+ */
+ // Set and Get are the same so we can hack just one letter
+ char letter;
+ // is this a Set request?
+ if (strstr(cmd, "SetBinaryState")) {
+ // set
+ letter = 'S';
+ if (strstr(cmd, "State>10