diff --git a/README.md b/README.md index 7fdfadb54..8edc4f8e2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Sonoff-Tasmota Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE. -Current version is **3.9.19** - See ```sonoff/_releasenotes.ino``` for change information. +Current version is **3.9.20** - See ```sonoff/_releasenotes.ino``` for change information. - This version provides all (Sonoff) modules in one file and starts up with Sonoff Basic. - Once uploaded select module using the configuration webpage or the commands ```Modules``` and ```Module```. diff --git a/api/arduino/sonoff.ino.bin b/api/arduino/sonoff.ino.bin index 391f562b6..5064ad5c4 100644 Binary files a/api/arduino/sonoff.ino.bin and b/api/arduino/sonoff.ino.bin differ diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 23df798ff..9fbfddea4 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,8 @@ -/* 3.9.19 20170219 +/* 3.9.20 20170221 + * Add minimal basic authentication to Web Admin mode (#87) + * Fix Hue and add HSB support (#89) + * + * 3.9.19 20170219 * Sonoff Led: Made GPIO04, 05 and 15 available for user * Sonoff Led: Add commands Fade, Speed, WakupDuration, Wakeup and LedTable * diff --git a/sonoff/settings.h b/sonoff/settings.h index 049cb3410..6da85fe97 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -184,5 +184,6 @@ struct SYSCFG { uint8_t emulation; + char web_password[33]; } sysCfg; diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 61f8f4e65..1abd9b1d9 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -437,7 +437,8 @@ void CFG_DefaultSet2() sysCfg.mqtt_enabled = MQTT_USE; sysCfg.emulation = EMULATION; - + + strlcpy(sysCfg.web_password, WEB_PASSWORD, sizeof(sysCfg.web_password)); } void CFG_Default() @@ -625,6 +626,9 @@ void CFG_Delta() if (sysCfg.version < 0x03090700) { // 3.9.7 - Add parameter sysCfg.emulation = EMULATION; } + if (sysCfg.version < 0x03091301) { + strlcpy(sysCfg.web_password, WEB_PASSWORD, sizeof(sysCfg.web_password)); + } sysCfg.version = VERSION; } diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 318f3f633..d68449037 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -10,7 +10,7 @@ * ==================================================== */ -#define VERSION 0x03091300 // 3.9.19 +#define VERSION 0x03091400 // 3.9.20 //#define BE_MINIMAL // Compile a minimal version if upgrade memory gets tight (still 404k) // To be used as step 1. Next step is compile and use desired version @@ -909,6 +909,16 @@ void mqttDataCb(char* topic, byte* data, unsigned int data_len) snprintf_P(svalue, sizeof(svalue), PSTR("{\"Webserver\":\"%s\"}"), MQTT_STATUS_OFF); } } + else if (!strcmp(type,"WEBPASSWORD")) { + if ((data_len > 0) && (data_len < sizeof(sysCfg.web_password))) { + if (payload == 0) { + sysCfg.web_password[0] = 0; // No password + } else { + strlcpy(sysCfg.web_password, (payload == 1) ? WEB_PASSWORD : dataBuf, sizeof(sysCfg.web_password)); + } + } + snprintf_P(svalue, sizeof(svalue), PSTR("{\"WebPassword\":\"%s\"}"), sysCfg.web_password); + } else if (!strcmp(type,"WEBLOG")) { if ((data_len > 0) && (payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) { sysCfg.weblog_level = payload; diff --git a/sonoff/user_config.h b/sonoff/user_config.h index d2b90a036..0581ad6ed 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -78,8 +78,10 @@ // -- HTTP ---------------------------------------- #define USE_WEBSERVER // Enable web server and wifi manager (+62k code, +4k mem) - Disable by // - #define FRIENDLY_NAME "Sonoff" // [FriendlyName] Friendlyname up to 32 characters used by webpages and Alexa #define WEB_SERVER 2 // [WebServer] Web server (0 = Off, 1 = Start as User, 2 = Start as Admin) + #define WEB_USERNAME "admin" // Web server Admin mode user name + #define WEB_PASSWORD "" // [WebPassword] Web server Admin mode Password for WEB_USERNAME (empty string = Disable) + #define FRIENDLY_NAME "Sonoff" // [FriendlyName] Friendlyname up to 32 characters used by webpages and Alexa #define USE_EMULATION // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+11k code, +2k mem) #define EMULATION EMUL_NONE // [Emulation] Select Belkin WeMo or Hue Bridge emulation (EMUL_NONE, EMUL_WEMO or EMUL_HUE) diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index 25080590c..ab4332408 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -171,6 +171,7 @@ const char HTTP_FORM_LOG3[] PROGMEM = const char HTTP_FORM_OTHER[] PROGMEM = "