"));
#endif // USE_EMULATION
@@ -2186,11 +2191,13 @@ void HandleNotFound(void)
if (CaptivePortal()) { return; } // If captive portal redirect instead of displaying the error page.
#ifdef USE_EMULATION
+#ifdef USE_EMULATION_HUE
String path = WebServer->uri();
if ((EMUL_HUE == Settings.flag2.emulation) && (path.startsWith("/api"))) {
HandleHueApi(&path);
} else
-#endif // USE_EMULATION
+#endif // USE_EMULATION_HUE
+#endif // USE_EMULATION
{
WSContentBegin(404, CT_PLAIN);
WSContentSend_P(PSTR(D_FILE_NOT_FOUND "\n\nURI: %s\nMethod: %s\nArguments: %d\n"), WebServer->uri().c_str(), (WebServer->method() == HTTP_GET) ? "GET" : "POST", WebServer->args());
@@ -2427,7 +2434,16 @@ bool WebCommand(void)
}
#ifdef USE_EMULATION
else if (CMND_EMULATION == command_code) {
+#if defined(USE_EMULATION_WEMO) && defined(USE_EMULATION_HUE)
if ((XdrvMailbox.payload >= EMUL_NONE) && (XdrvMailbox.payload < EMUL_MAX)) {
+#else
+#ifndef USE_EMULATION_WEMO
+ if ((EMUL_NONE == XdrvMailbox.payload) || (EMUL_HUE == XdrvMailbox.payload)) {
+#endif
+#ifndef USE_EMULATION_HUE
+ if ((EMUL_NONE == XdrvMailbox.payload) || (EMUL_WEMO == XdrvMailbox.payload)) {
+#endif
+#endif
Settings.flag2.emulation = XdrvMailbox.payload;
restart_flag = 2;
}
diff --git a/sonoff/xdrv_02_mqtt.ino b/sonoff/xdrv_02_mqtt.ino
index cc510b20c..4d60e157b 100644
--- a/sonoff/xdrv_02_mqtt.ino
+++ b/sonoff/xdrv_02_mqtt.ino
@@ -423,7 +423,7 @@ void MqttReconnect(void)
return;
}
-#if defined(USE_WEBSERVER) && defined(USE_EMULATION)
+#ifdef USE_EMULATION
UdpDisconnect();
#endif // USE_EMULATION
diff --git a/sonoff/xplg_wemohue.ino b/sonoff/xdrv_20_hue.ino
similarity index 64%
rename from sonoff/xplg_wemohue.ino
rename to sonoff/xdrv_20_hue.ino
index b4ca72124..d54becd66 100644
--- a/sonoff/xplg_wemohue.ino
+++ b/sonoff/xdrv_20_hue.ino
@@ -1,5 +1,5 @@
/*
- xplg_wemohue.ino - wemo and hue support for Sonoff-Tasmota
+ xdrv_20_hue.ino - Philips Hue support for Sonoff-Tasmota
Copyright (C) 2019 Heiko Krupp and Theo Arends
@@ -17,93 +17,10 @@
along with this program. If not, see