diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index a95e77df..5dc9e6dc 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -642,7 +642,7 @@ PROGMEM const char* const custom_reset_string[] = { // ----------------------------------------------------------------------------- #ifndef THINGSPEAK_SUPPORT -#define THINGSPEAK_SUPPORT 0 // Enable Thingspeak support by default (???Kb) +#define THINGSPEAK_SUPPORT 1 // Enable Thingspeak support by default (2.56Kb) #endif #define THINGSPEAK_ENABLED 0 // Thingspeak disabled by default diff --git a/code/espurna/thinkspeak.ino b/code/espurna/thinkspeak.ino index b1f9cae0..9c689005 100644 --- a/code/espurna/thinkspeak.ino +++ b/code/espurna/thinkspeak.ino @@ -34,7 +34,8 @@ unsigned long _tspk_last_flush = 0; void _tspkWebSocketOnSend(JsonObject& root) { - root["tspkVisible"] = 1; + unsigned char visible = 0; + root["tspkEnabled"] = getSetting("tspkEnabled", THINGSPEAK_ENABLED).toInt() == 1; root["tspkKey"] = getSetting("tspkKey"); @@ -42,6 +43,7 @@ void _tspkWebSocketOnSend(JsonObject& root) { for (byte i=0; i 0) visible = 1; #if SENSOR_SUPPORT JsonArray& list = root.createNestedArray("tspkMagnitudes"); @@ -52,8 +54,11 @@ void _tspkWebSocketOnSend(JsonObject& root) { element["index"] = magnitudeIndex(i); element["idx"] = getSetting("tspkMagnitude", i, 0).toInt(); } + if (magnitudeCount() > 0) visible = 1; #endif + root["tspkVisible"] = visible; + } void _tspkConfigure() {