From 193fdc91186f49cb4f317b7865ce44f2323aa8a4 Mon Sep 17 00:00:00 2001 From: arendst Date: Sat, 10 Feb 2018 15:13:27 +0100 Subject: [PATCH] v5.12.0a - Fixes and changes 5.12.0a * Change platformio option sonoff-ds18x20 to sonoff-xxl enabling ds18x20 and all other sensors in one image * Fix providing web page configuratin option for Friendly Name when no device (relay or light) is configured (#1850) * Change default paremeters in user_config.h to undefined for easy installation (#1851) * Change max user configurable hold time from 10 to 25 seconds (#1851) --- platformio.ini | 52 +++++++++++------------ sonoff/_releasenotes.ino | 4 ++ sonoff/sonoff.ino | 2 +- sonoff/sonoff_post.h | 89 ++++++++++++++++++++++++++++------------ sonoff/support.ino | 8 ++-- sonoff/user_config.h | 23 +++++++---- sonoff/webserver.ino | 2 +- 7 files changed, 114 insertions(+), 66 deletions(-) diff --git a/platformio.ini b/platformio.ini index ccd926298..1cba5f3bc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -12,6 +12,8 @@ src_dir = sonoff ; *** Uncomment one of the lines below to build/upload only one environment ;env_default = sonoff +;env_default = sonoff-minimal +;env_default = sonoff-xxl ;env_default = sonoff-DE ;env_default = sonoff-ES ;env_default = sonoff-FR @@ -19,8 +21,6 @@ src_dir = sonoff ;env_default = sonoff-NL ;env_default = sonoff-PL ;env_default = sonoff-CN -;env_default = sonoff-minimal -;env_default = sonoff-ds18x20 [env:sonoff] platform = espressif8266 @@ -47,6 +47,30 @@ monitor_baud = 115200 ;upload_port = domus1:80/api/upload-arduino.php ;extra_scripts = pio/strip-floats.py, pio/http-uploader.py +[env:sonoff-minimal] +platform = espressif8266 +framework = arduino +board = esp01_1m +board_flash_mode = dout +build_flags = -Wl,-Tesp8266.flash.1m0.ld -DBE_MINIMAL +lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON +extra_scripts = pio/strip-floats.py + +; Serial Monitor options +monitor_baud = 115200 + +[env:sonoff-xxl] +platform = espressif8266 +framework = arduino +board = esp01_1m +board_flash_mode = dout +build_flags = -Wl,-Tesp8266.flash.1m0.ld -DUSE_ALL_SENSORS +lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON +extra_scripts = pio/strip-floats.py + +; Serial Monitor options +monitor_baud = 115200 + [env:sonoff-DE] platform = espressif8266 framework = arduino @@ -130,27 +154,3 @@ extra_scripts = pio/strip-floats.py ; *** Serial Monitor options monitor_baud = 115200 - -[env:sonoff-minimal] -platform = espressif8266 -framework = arduino -board = esp01_1m -board_flash_mode = dout -build_flags = -Wl,-Tesp8266.flash.1m0.ld -DBE_MINIMAL -lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON -extra_scripts = pio/strip-floats.py - -; Serial Monitor options -monitor_baud = 115200 - -[env:sonoff-ds18x20] -platform = espressif8266 -framework = arduino -board = esp01_1m -board_flash_mode = dout -build_flags = -Wl,-Tesp8266.flash.1m0.ld -DUSE_DS18x20 -lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON -extra_scripts = pio/strip-floats.py - -; Serial Monitor options -monitor_baud = 115200 diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index e071bc7bb..2085d3135 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,8 @@ /* 5.12.0a + * Change platformio option sonoff-ds18x20 to sonoff-xxl enabling ds18x20 and all other sensors in one image + * Fix providing web page configuratin option for Friendly Name when no device (relay or light) is configured (#1850) + * Change default paremeters in user_config.h to undefined for easy installation (#1851) + * Change max user configurable hold time from 10 to 25 seconds (#1851) * * 5.12.0 20180209 * Change library PubSubClient.h define MQTT_MAX_PACKET_SIZE from 512 to 1000 for Home Assistant support diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index c31ba5f6a..98ba5121b 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -1040,7 +1040,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len) else { // SetOption32 .. switch (index) { case P_HOLD_TIME: - if ((payload >= 1) && (payload <= 100)) { + if ((payload >= 1) && (payload <= 250)) { Settings.param[P_HOLD_TIME] = payload; } break; diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 18e603ea8..76086030e 100644 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -33,77 +33,114 @@ void WifiWpsStatusCallback(wps_cb_status status); } #endif -#define USE_DHT // Default DHT11 sensor needs no external library +#define USE_DHT // Default DHT11 sensor needs no external library + +#ifdef USE_ALL_SENSORS // ===================== Configure sonoff-xxl.bin ========================= +#define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices +#define USE_DS18x20 // For more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) +//#define USE_DS18x20_LEGACY // For more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code) +#define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram) +#define USE_SHT // Add I2C emulating code for SHT1X sensor (+1k4 code) +#define USE_SHT3X // Add I2C code for SHT3x sensor (+0k6 code) +#define USE_HTU // Add I2C code for HTU21/SI7013/SI7020/SI7021 sensor (+1k5 code) +#define USE_BMP // Add I2C code for BMP085/BMP180/BMP280/BME280 sensor (+4k code) + #define USE_BME680 // Add additional support for BME680 sensor using Adafruit Sensor and BME680 libraries (+6k code) +#define USE_BH1750 // Add I2C code for BH1750 sensor (+0k5 code) +#define USE_VEML6070 // Add I2C code for VEML6070 sensor (+0k5 code) +#define USE_TSL2561 // Add I2C code for TSL2561 sensor using library Adafruit TSL2561 Arduino (+1k2 code) +#define USE_ADS1115 // Add I2C code for ADS1115 16 bit A/D converter based on Adafruit ADS1x15 library (no library needed) (+0k7 code) +// #define USE_ADS1115_I2CDEV // Add I2C code for ADS1115 16 bit A/D converter using library i2cdevlib-Core and i2cdevlib-ADS1115 (+2k code) +#define USE_INA219 // Add I2C code for INA219 Low voltage and current sensor (+1k code) +#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code) +#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code) +#ifndef CO2_LOW + #define CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) +#endif +#ifndef CO2_HIGH + #define CO2_HIGH 1200 // Above this CO2 value show red light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) +#endif +#define USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code) +#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code) +#define USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k code, 0k3 mem, 48 iram) + #define USE_IR_HVAC // Support for HVAC system using IR (+2k code) + #define USE_IR_RECEIVE // Support for IR receiver (+5k5 code, 264 iram) +#define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by // +#ifndef USE_WS2812_CTYPE + #define USE_WS2812_CTYPE 1 // WS2812 Color type (0 - RGB, 1 - GRB, 2 - RGBW, 3 - GRBW) +#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)) +#endif // USE_ALL_SENSORS ===================== #if defined(USE_DS18x20) || defined(USE_DS18x20_LEGACY) #else -#define USE_DS18B20 // Default DS18B20 sensor needs no external library +#define USE_DS18B20 // Default DS18B20 sensor needs no external library #endif -//#define DEBUG_THEO // Add debug code +//#define DEBUG_THEO // Add debug code -#ifdef BE_MINIMAL +#ifdef BE_MINIMAL // ========================== Configure sonoff-minimal.bin ===================== #ifdef USE_MQTT_TLS -#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set +#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set #endif #ifdef USE_DISCOVERY -#undef USE_DISCOVERY // Disable Discovery services for both MQTT and web server +#undef USE_DISCOVERY // Disable Discovery services for both MQTT and web server #endif #ifdef USE_DOMOTICZ -#undef USE_DOMOTICZ // Disable Domoticz +#undef USE_DOMOTICZ // Disable Domoticz #endif #ifdef USE_HOME_ASSISTANT -#undef USE_HOME_ASSISTANT // Disable Home Assistant +#undef USE_HOME_ASSISTANT // Disable Home Assistant #endif //#ifdef USE_WEBSERVER -//#undef USE_WEBSERVER // Disable Webserver +//#undef USE_WEBSERVER // Disable Webserver //#endif #ifdef USE_EMULATION -#undef USE_EMULATION // Disable Wemo or Hue emulation +#undef USE_EMULATION // Disable Wemo or Hue emulation #endif #ifdef USE_PZEM004T -#undef USE_PZEM004T // Disable PZEM004T energy sensor +#undef USE_PZEM004T // Disable PZEM004T energy sensor #endif #ifdef USE_DS18x20 -#undef USE_DS18x20 // Disable DS18x20 sensor +#undef USE_DS18x20 // Disable DS18x20 sensor #endif #ifdef USE_I2C -#undef USE_I2C // Disable all I2C sensors and devices +#undef USE_I2C // Disable all I2C sensors and devices #endif #ifdef USE_SPI -#undef USE_SPI // Disable all SPI devices +#undef USE_SPI // Disable all SPI devices #endif #ifdef USE_WS2812 -#undef USE_WS2812 // Disable WS2812 Led string +#undef USE_WS2812 // Disable WS2812 Led string #endif #ifdef USE_DS18B20 -#undef USE_DS18B20 // Disable internal DS18B20 sensor +#undef USE_DS18B20 // Disable internal DS18B20 sensor #endif #ifdef USE_DHT -#undef USE_DHT // Disable internal DHT sensor +#undef USE_DHT // Disable internal DHT sensor #endif #ifdef USE_DISPLAY -#undef USE_DISPLAY // Disable Display support +#undef USE_DISPLAY // Disable Display support #endif #ifdef USE_MHZ19 -#undef USE_MHZ19 // Disable support for MH-Z19 CO2 sensor +#undef USE_MHZ19 // Disable support for MH-Z19 CO2 sensor #endif #ifdef USE_SENSEAIR -#undef USE_SENSEAIR // Disable support for SenseAir K30, K70 and S8 CO2 sensor +#undef USE_SENSEAIR // Disable support for SenseAir K30, K70 and S8 CO2 sensor #endif #ifdef USE_IR_REMOTE -#undef USE_IR_REMOTE // Disable IR driver +#undef USE_IR_REMOTE // Disable IR driver #endif #ifdef USE_ARILUX_RF -#undef USE_ARILUX_RF // Disable support for Arilux RF remote controller +#undef USE_ARILUX_RF // Disable support for Arilux RF remote controller #endif #ifdef DEBUG_THEO -#undef DEBUG_THEO // Disable debug code +#undef DEBUG_THEO // Disable debug code #endif -#endif // BE_MINIMAL +#endif // BE_MINIMAL ========================== #ifndef SWITCH_MODE -#define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state) +#define SWITCH_MODE TOGGLE // TOGGLE, FOLLOW or FOLLOW_INV (the wall switch state) #endif #ifndef MQTT_FINGERPRINT @@ -111,7 +148,7 @@ void WifiWpsStatusCallback(wps_cb_status status); #endif #ifndef WS2812_LEDS -#define WS2812_LEDS 30 // [Pixels] Number of LEDs +#define WS2812_LEDS 30 // [Pixels] Number of LEDs #endif #ifndef MESSZ diff --git a/sonoff/support.ino b/sonoff/support.ino index b1196f7f1..936ddbbf4 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -519,20 +519,20 @@ void WifiConfig(uint8_t type) restart_flag = 2; } else if (WIFI_SMARTCONFIG == wifi_config_type) { - AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_1_SMARTCONFIG D_ACTIVE_FOR_3_MINUTES)); + AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_1_SMARTCONFIG " " D_ACTIVE_FOR_3_MINUTES)); WiFi.beginSmartConfig(); } else if (WIFI_WPSCONFIG == wifi_config_type) { if (WifiWpsConfigBegin()) { - AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG D_ACTIVE_FOR_3_MINUTES)); + AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG " " D_ACTIVE_FOR_3_MINUTES)); } else { - AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG D_FAILED_TO_START)); + AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG " " D_FAILED_TO_START)); wifi_config_counter = 3; } } #ifdef USE_WEBSERVER else if (WIFI_MANAGER == wifi_config_type) { - AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER D_ACTIVE_FOR_3_MINUTES)); + AddLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER " " D_ACTIVE_FOR_3_MINUTES)); WifiManagerBegin(); } #endif // USE_WEBSERVER diff --git a/sonoff/user_config.h b/sonoff/user_config.h index fde332a2c..be57abb88 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -52,22 +52,22 @@ #define WIFI_SUBNETMASK "255.255.255.0" // [IpAddress3] If not using DHCP set Network mask #define WIFI_DNS "192.168.2.27" // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY) -#define STA_SSID1 "indebuurt1" // [Ssid1] Wifi SSID -#define STA_PASS1 "VnsqrtnrsddbrN" // [Password1] Wifi password -#define STA_SSID2 "indebuurt2" // [Ssid2] Optional alternate AP Wifi SSID -#define STA_PASS2 "VnsqrtnrsddbrN" // [Password2] Optional alternate AP Wifi password +#define STA_SSID1 "" // [Ssid1] Wifi SSID +#define STA_PASS1 "" // [Password1] Wifi password +#define STA_SSID2 "" // [Ssid2] Optional alternate AP Wifi SSID +#define STA_PASS2 "" // [Password2] Optional alternate AP Wifi password #define WIFI_CONFIG_TOOL WIFI_WPSCONFIG // [WifiConfig] Default tool if wifi fails to connect // (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT) // -- Syslog -------------------------------------- -#define SYS_LOG_HOST "domus1" // [LogHost] (Linux) syslog host +#define SYS_LOG_HOST "" // [LogHost] (Linux) syslog host #define SYS_LOG_PORT 514 // [LogPort] default syslog UDP port #define SYS_LOG_LEVEL LOG_LEVEL_NONE // [SysLog] #define SERIAL_LOG_LEVEL LOG_LEVEL_INFO // [SerialLog] #define WEB_LOG_LEVEL LOG_LEVEL_INFO // [WebLog] // -- Ota ----------------------------------------- -#define OTA_URL "http://domus1:80/api/arduino/" PROJECT ".ino.bin" // [OtaUrl] +#define OTA_URL "http://sonoff.maddox.co.uk/tasmota/sonoff.ino.bin" // [OtaUrl] // -- MQTT ---------------------------------------- #define MQTT_USE 1 // [SetOption3] Select default MQTT use (0 = Off, 1 = On) @@ -75,13 +75,14 @@ //#define USE_MQTT_TLS // EXPERIMENTAL Use TLS for MQTT connection (+53k code, +20k mem) - Disable by // // Needs Fingerprint, TLS Port, UserId and Password #ifdef USE_MQTT_TLS - #define MQTT_HOST "m20.cloudmqtt.com" // [MqttHost] +// #define MQTT_HOST "m20.cloudmqtt.com" // [MqttHost] + #define MQTT_HOST "" // [MqttHost] #define MQTT_FINGERPRINT "A5 02 FF 13 99 9F 8B 39 8E F1 83 4F 11 23 65 0B 32 36 FC 07" // [MqttFingerprint] #define MQTT_PORT 20123 // [MqttPort] MQTT TLS port #define MQTT_USER "cloudmqttuser" // [MqttUser] Mandatory user #define MQTT_PASS "cloudmqttpassword" // [MqttPassword] Mandatory password #else - #define MQTT_HOST "domus1" // [MqttHost] + #define MQTT_HOST "" // [MqttHost] #define MQTT_PORT 1883 // [MqttPort] MQTT port (10123 on CloudMQTT) #define MQTT_USER "DVES_USER" // [MqttUser] Optional user #define MQTT_PASS "DVES_PASS" // [MqttPassword] Optional password @@ -212,6 +213,12 @@ #define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0)) +/*********************************************************************************************\ + * Select all sensors - overrides above undefines!! +\*********************************************************************************************/ + +//#define USE_ALL_SENSORS // Create sonoff-xxl with all sensors enabled (See sonoff_post.h for selected sensors) + /*********************************************************************************************\ * Compile a minimal version if upgrade memory gets tight ONLY TO BE USED FOR UPGRADE STEP 1! * To be used as step 1 during upgrade. diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index a1fef74e9..cdfdc5aa9 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -941,7 +941,7 @@ void HandleOtherConfiguration() page += FPSTR(HTTP_HEAD_STYLE); page += FPSTR(HTTP_FORM_OTHER); page.replace(F("{r1"), (Settings.flag.mqtt_enabled) ? F(" checked") : F("")); - uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : devices_present; + uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : (!devices_present) ? 1 : devices_present; for (byte i = 0; i < maxfn; i++) { page += FPSTR(HTTP_FORM_OTHER2); page.replace(F("{1"), String(i +1));