diff --git a/sonoff/i18n.h b/sonoff/i18n.h index fc6a43db4..f50242d86 100644 --- a/sonoff/i18n.h +++ b/sonoff/i18n.h @@ -372,6 +372,8 @@ /********************************************************************************************/ +#define D_ASTERIX "********" + #ifndef MY_LANGUAGE #include "language/en-GB.h" #else @@ -435,11 +437,13 @@ const char S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE[] PROGMEM = "{\"%s\":\"%d (" D const char S_JSON_COMMAND_NVALUE[] PROGMEM = "{\"%s\":%d}"; const char S_JSON_COMMAND_LVALUE[] PROGMEM = "{\"%s\":%lu}"; const char S_JSON_COMMAND_SVALUE[] PROGMEM = "{\"%s\":\"%s\"}"; +const char S_JSON_COMMAND_ASTERIX[] PROGMEM = "{\"%s\":\"" D_ASTERIX "\"}"; const char S_JSON_COMMAND_XVALUE[] PROGMEM = "{\"%s\":%s}"; // %s must provide quotes on non-number const char S_JSON_COMMAND_INDEX_NVALUE[] PROGMEM = "{\"%s%d\":%d}"; const char S_JSON_COMMAND_INDEX_LVALUE[] PROGMEM = "{\"%s%d\":%lu}"; const char S_JSON_COMMAND_INDEX_SVALUE[] PROGMEM = "{\"%s%d\":\"%s\"}"; +const char S_JSON_COMMAND_INDEX_ASTERIX[] PROGMEM = "{\"%s%d\":\"" D_ASTERIX "\"}"; const char S_JSON_COMMAND_INDEX_SVALUE_SVALUE[] PROGMEM = "{\"%s%d\":\"%s%s\"}"; const char S_JSON_COMMAND_INDEX_NVALUE_ACTIVE_NVALUE[] PROGMEM = "{\"%s%d\":\"%d (" D_JSON_ACTIVE " %d)\"}"; diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 00850b891..4bb89b6e6 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -922,8 +922,10 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) strlcpy(Settings.sta_pwd[index -1], (1 == payload) ? (1 == index) ? STA_PASS1 : STA_PASS2 : dataBuf, sizeof(Settings.sta_pwd[0])); Settings.sta_active = index -1; restart_flag = 2; + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]); + } else { + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_ASTERIX, command, index); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, Settings.sta_pwd[index -1]); } else if ((CMND_HOSTNAME == command_code) && !grpflg) { if ((data_len > 0) && (data_len < sizeof(Settings.hostname))) { @@ -978,8 +980,10 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) else if (CMND_WEBPASSWORD == command_code) { if ((data_len > 0) && (data_len < sizeof(Settings.web_password))) { strlcpy(Settings.web_password, (!strcmp(dataBuf,"0")) ? "" : (1 == payload) ? WEB_PASSWORD : dataBuf, sizeof(Settings.web_password)); + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.web_password); + } else { + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_ASTERIX, command); } - snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.web_password); } else if (CMND_WEBLOG == command_code) { if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) Settings.weblog_level = payload; diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 47a752c72..09d68f89a 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -79,6 +79,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #endif // #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow #define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) +#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code) #endif // USE_ALL_SENSORS ===================== #if defined(USE_DS18x20) || defined(USE_DS18x20_LEGACY) @@ -99,6 +100,9 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_HOME_ASSISTANT #undef USE_HOME_ASSISTANT // Disable Home Assistant #endif +#ifdef USE_KNX +#undef USE_KNX // Disable KNX IP Protocol Support +#endif //#ifdef USE_WEBSERVER //#undef USE_WEBSERVER // Disable Webserver //#endif @@ -111,30 +115,24 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_SUNRISE #undef USE_SUNRISE // Disable support for Sunrise and sunset tools #endif -#ifdef USE_KNX -#undef USE_KNX // Disable KNX IP Protocol Support +#ifdef USE_RULES +#undef USE_RULES // Disable support for rules #endif -#ifdef USE_PZEM004T -#undef USE_PZEM004T // Disable PZEM004T energy sensor +#ifdef USE_DHT +#undef USE_DHT // Disable internal DHT sensor #endif #ifdef USE_DS18x20 #undef USE_DS18x20 // Disable DS18x20 sensor #endif +#ifdef USE_DS18B20 +#undef USE_DS18B20 // Disable internal DS18B20 sensor +#endif #ifdef USE_I2C #undef USE_I2C // Disable all I2C sensors and devices #endif #ifdef USE_SPI #undef USE_SPI // Disable all SPI devices #endif -#ifdef USE_WS2812 -#undef USE_WS2812 // Disable WS2812 Led string -#endif -#ifdef USE_DS18B20 -#undef USE_DS18B20 // Disable internal DS18B20 sensor -#endif -#ifdef USE_DHT -#undef USE_DHT // Disable internal DHT sensor -#endif #ifdef USE_DISPLAY #undef USE_DISPLAY // Disable Display support #endif @@ -144,12 +142,30 @@ void KNX_CB_Action(message_t const &msg, void *arg); #ifdef USE_SENSEAIR #undef USE_SENSEAIR // Disable support for SenseAir K30, K70 and S8 CO2 sensor #endif +#ifdef USE_PMS5003 +#undef USE_PMS5003 // Disable support for PMS5003 and PMS7003 particle concentration sensor +#endif +#ifdef USE_NOVA_SDS +#undef USE_NOVA_SDS // Disable support for SDS011 and SDS021 particle concentration sensor +#endif +#ifdef USE_PZEM004T +#undef USE_PZEM004T // Disable PZEM004T energy sensor +#endif +#ifdef USE_SERIAL_BRIDGE +#undef USE_SERIAL_BRIDGE // Disable support for software Serial Bridge +#endif #ifdef USE_IR_REMOTE #undef USE_IR_REMOTE // Disable IR driver #endif +#ifdef USE_WS2812 +#undef USE_WS2812 // Disable WS2812 Led string +#endif #ifdef USE_ARILUX_RF #undef USE_ARILUX_RF // Disable support for Arilux RF remote controller #endif +#ifdef USE_SR04 +#undef USE_SR04 // Disable support for for HC-SR04 ultrasonic devices +#endif #ifdef DEBUG_THEO #undef DEBUG_THEO // Disable debug code #endif diff --git a/sonoff/support.ino b/sonoff/support.ino index 34d271644..8bc76d6a8 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -740,7 +740,7 @@ void WifiCheck(uint8_t param) strlcpy(Settings.sta_pwd[0], WiFi.psk().c_str(), sizeof(Settings.sta_pwd[0])); } Settings.sta_active = 0; - snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s, " D_CMND_PASSWORD "1 %s"), Settings.sta_ssid[0], Settings.sta_pwd[0]); + snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s"), Settings.sta_ssid[0]); AddLog(LOG_LEVEL_INFO); } } diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index 1dc3eda52..c6dcab568 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -227,9 +227,9 @@ const char HTTP_FORM_WIFI[] PROGMEM = "