diff --git a/code/html/index.html b/code/html/index.html index 0bad0b49..7b9cddd7 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -178,6 +178,11 @@
The administrator password is used to access this web interface (user 'admin'), but also to connect to the device when in AP mode or to flash a new firmware over-the-air (OTA).
+
+
+
+
+
diff --git a/code/lib/fauxmoESP b/code/lib/fauxmoESP index a04b0f77..bce66aba 160000 --- a/code/lib/fauxmoESP +++ b/code/lib/fauxmoESP @@ -1 +1 @@ -Subproject commit a04b0f77b59e19698fdeb087aeb60e18a5adf858 +Subproject commit bce66aba0ec2707e0139f859f1dd3dff0c06ef14 diff --git a/code/platformio.ini b/code/platformio.ini index 8accde12..6045d204 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -86,7 +86,7 @@ framework = arduino lib_install = ${common.lib_install} extra_script = pio_hooks.py board = nodemcuv2 -build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial +build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial -DENABLE_FAUXMO=1 [env:node-debug-ota] platform = espressif8266 diff --git a/code/src/defaults.h b/code/src/defaults.h index 250056c2..7bbfd7be 100644 --- a/code/src/defaults.h +++ b/code/src/defaults.h @@ -10,6 +10,7 @@ //#define S20 //#define NODEMCUV2 +//#define ENABLE_FAUXMO 1 //#define ENABLE_NOFUSS 1 //#define ENABLE_EMON 1 //#define ENABLE_DHT 1 @@ -153,4 +154,4 @@ #define POW_UPDATE_INTERVAL 10000 #define POW_REPORT_EVERY 6 -#define FAUXMO_ENABLED 1 +#define FAUXMO_ENABLED 0 diff --git a/code/src/fauxmo.ino b/code/src/fauxmo.ino index f1459c0f..2449ecb9 100644 --- a/code/src/fauxmo.ino +++ b/code/src/fauxmo.ino @@ -7,6 +7,8 @@ Copyright (C) 2016 by Xose PĂ©rez */ +#if ENABLE_FAUXMO + #include fauxmoESP fauxmo; @@ -17,13 +19,15 @@ fauxmoESP fauxmo; void fauxmoConfigure() { fauxmo.setDeviceName(getSetting("hostname", HOSTNAME).c_str()); - fauxmo.enable(getSetting('fauxmoEnabled', String(FAUXMO_ENABLED)).toInt() == 1); + fauxmo.enable(getSetting("fauxmoEnabled", String(FAUXMO_ENABLED)).toInt() == 1); } void fauxmoSetup() { fauxmoConfigure(); fauxmo.onMessage([](const char * state) { DEBUG_MSG("[FAUXMO] State: %s\n", state); - (state[0] == '1') ? switchRelayOn() : switchRelayOff(); + relayStatus(0, state[0] == '1'); }); } + +#endif diff --git a/code/src/main.ino b/code/src/main.ino index ff98a592..be5a5d48 100644 --- a/code/src/main.ino +++ b/code/src/main.ino @@ -147,8 +147,10 @@ void setup() { mqttSetup(); webSetup(); ntpSetup(); - fauxmoSetup(); + #if ENABLE_FAUXMO + fauxmoSetup(); + #endif #if ENABLE_NOFUSS nofussSetup(); #endif diff --git a/code/src/web.ino b/code/src/web.ino index 4a9c7e96..21d6347d 100644 --- a/code/src/web.ino +++ b/code/src/web.ino @@ -72,6 +72,9 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) { bool dirty = false; bool dirtyMQTT = false; bool apiEnabled = false; + #if ENABLE_FAUXMO + bool fauxmoEnabled = false; + #endif unsigned int network = 0; for (unsigned int i=0; i