diff --git a/README.md b/README.md index 5d8361776..7f2f0b2f0 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 **5.8.0n** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.8.0o** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 82a039fe1..878898d39 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,8 +1,14 @@ -/* 5.8.0n +/* 5.8.0o + * Remove max string length of 14 for Domoticz sensor descriptions + * Add light scheme options (Color cycle Up, Down, Random) and moving WS2812 schemes up by 3 + * Add support for VEML6070 I2C Ultra Violet level sensor (#1053) + * + * 5.8.0n * Fix minimum TelePeriod of 10 seconds set by web page * Shrink information web page by 1k code space * Removed Arduino IDE version too low warning as it interferes with platformio.ini platform = espressif8266_stage * Add commands Color2, Color3, Color4, Width2, Width3, Width4 and SetOption16 to set Ws2812 Clock parameters (#1019) + * Fix Color3 and Color4 (#1019) * Add Polish language file (#1044, #1047) * Add support for KMC 70011 Power Monitoring Smart Plug (#1045) * Corrected German language file (#1054) diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h index feccbf958..b6f450330 100644 --- a/sonoff/language/de-DE.h +++ b/sonoff/language/de-DE.h @@ -188,8 +188,9 @@ #define D_UPGRADE "upgrade" #define D_UPLOAD "upload" #define D_UPTIME "Laufzeit" -#define D_UTC_TIME "UTC" #define D_USER "Benutzer" +#define D_UTC_TIME "UTC" +#define D_UV_LEVEL "UV Level" #define D_VCC "VCC" #define D_VERSION "Version" #define D_VOLTAGE "Spannung" @@ -373,7 +374,6 @@ #define D_DOMOTICZ_KEY_IDX "Key idx" #define D_DOMOTICZ_SWITCH_IDX "Switch idx" #define D_DOMOTICZ_SENSOR_IDX "Sensor idx" - #define DOMOTICZ_SENSORS_MAX_STRING_LENGTH 14 #define D_DOMOTICZ_TEMP "Temp" #define D_DOMOTICZ_TEMP_HUM "Temp,Hum" #define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Hum,Baro" diff --git a/sonoff/language/en-GB.h b/sonoff/language/en-GB.h index 82f49cee6..2d7689338 100644 --- a/sonoff/language/en-GB.h +++ b/sonoff/language/en-GB.h @@ -188,8 +188,9 @@ #define D_UPGRADE "upgrade" #define D_UPLOAD "Upload" #define D_UPTIME "Uptime" -#define D_UTC_TIME "UTC" #define D_USER "User" +#define D_UTC_TIME "UTC" +#define D_UV_LEVEL "UV Level" #define D_VCC "Vcc" #define D_VERSION "Version" #define D_VOLTAGE "Voltage" @@ -373,7 +374,6 @@ #define D_DOMOTICZ_KEY_IDX "Key idx" #define D_DOMOTICZ_SWITCH_IDX "Switch idx" #define D_DOMOTICZ_SENSOR_IDX "Sensor idx" - #define DOMOTICZ_SENSORS_MAX_STRING_LENGTH 14 #define D_DOMOTICZ_TEMP "Temp" #define D_DOMOTICZ_TEMP_HUM "Temp,Hum" #define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Hum,Baro" diff --git a/sonoff/language/nl-NL.h b/sonoff/language/nl-NL.h index 30aba2e1e..e7fb40fd9 100644 --- a/sonoff/language/nl-NL.h +++ b/sonoff/language/nl-NL.h @@ -188,8 +188,9 @@ #define D_UPGRADE "opwaarderen" #define D_UPLOAD "Verzenden" #define D_UPTIME "Bedrijfstijd" -#define D_UTC_TIME "UTC" #define D_USER "Gebruiker" +#define D_UTC_TIME "UTC" +#define D_UV_LEVEL "UV niveau" #define D_VCC "Vcc" #define D_VERSION "Versie" #define D_VOLTAGE "Spanning" @@ -373,7 +374,6 @@ #define D_DOMOTICZ_KEY_IDX "Toets idx" #define D_DOMOTICZ_SWITCH_IDX "Schakelaar idx" #define D_DOMOTICZ_SENSOR_IDX "Sensor idx" - #define DOMOTICZ_SENSORS_MAX_STRING_LENGTH 14 #define D_DOMOTICZ_TEMP "Temp" #define D_DOMOTICZ_TEMP_HUM "Temp,Hum" #define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Hum,Baro" diff --git a/sonoff/language/pl-PL.h b/sonoff/language/pl-PL.h index 8c2b8ccc7..0e41849f5 100644 --- a/sonoff/language/pl-PL.h +++ b/sonoff/language/pl-PL.h @@ -188,8 +188,9 @@ #define D_UPGRADE "Aktualizacji" #define D_UPLOAD "Wgraj" #define D_UPTIME "Uptime" -#define D_UTC_TIME "UTC" #define D_USER "Uzytkownik" +#define D_UTC_TIME "UTC" +#define D_UV_LEVEL "UV Level" #define D_VCC "VCC" #define D_VERSION "Wersja" #define D_VOLTAGE "Napiecie" @@ -373,7 +374,6 @@ #define D_DOMOTICZ_KEY_IDX "Key idx" #define D_DOMOTICZ_SWITCH_IDX "Przelacznik idx" #define D_DOMOTICZ_SENSOR_IDX "Sensor idx" - #define DOMOTICZ_SENSORS_MAX_STRING_LENGTH 14 #define D_DOMOTICZ_TEMP "Temp" #define D_DOMOTICZ_TEMP_HUM "Temp,Wilg" #define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Wilg,Cis" diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 4d0982816..6259a1c1d 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -107,5 +107,8 @@ enum ButtonStates {PRESSED, NOT_PRESSED}; enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_MAX_PARAM8}; enum Ws2812ClockIndex {WS_SECOND, WS_MINUTE, WS_HOUR}; enum Ws2812Color {WS_RED, WS_GREEN, WS_BLUE}; +enum LightTypes {LT_BASIC, LT_PWM1, LT_PWM2, LT_PWM3, LT_PWM4, LT_PWM5, LT_PWM6, LT_PWM7, LT_NU8, LT_NU9, LT_NU10, LT_WS2812, LT_RGBW, LT_RGBWC}; +enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_RGBWC}; +enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX}; #endif // _SONOFF_H_ \ No newline at end of file diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 1caf50d4c..84df3e318 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x0508000E // 5.8.0n +#define VERSION 0x0508000F // 5.8.0o // Location specific includes #include "sonoff.h" // Enumaration used in user_config.h @@ -1792,7 +1792,10 @@ void MqttShowSensor(uint8_t* djson) #ifdef USE_BH1750 MqttShowBh1750(djson); #endif // USE_BH1750 - } +#ifdef USE_VEML6070 + MqttShowVeml6070(djson); +#endif // USE_VEML6070 +} #endif // USE_I2C if (strstr_P(mqtt_data, PSTR(D_TEMPERATURE))) { snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s, \"" D_TEMPERATURE_UNIT "\":\"%c\""), mqtt_data, TempUnit()); @@ -1878,7 +1881,10 @@ void PerformEverySecond() #ifdef USE_BH1750 Bh1750Detect(); #endif // USE_BH1750 - } +#ifdef USE_VEML6070 + Veml6070Detect(); +#endif // USE_VEML6070 +} #endif // USE_I2C } if (tele_period >= Settings.tele_period) { @@ -2532,7 +2538,7 @@ void GpioInit() devices_present = 1; if (Settings.flag.pwm_control) { - light_type = 0; + light_type = LT_BASIC; for (byte i = 0; i < MAX_PWMS; i++) { if (pin[GPIO_PWM1 +i] < 99) { light_type++; // Use Dimmer/Color control for all PWM as SetOption15 = 1 @@ -2556,20 +2562,20 @@ void GpioInit() } else if ((H801 == Settings.module) || (MAGICHOME == Settings.module)) { // PWM RGBCW led if (!Settings.flag.pwm_control) { - light_type = 0; // Use basic PWM control if SetOption15 = 0 + light_type = LT_BASIC; // Use basic PWM control if SetOption15 = 0 } } else if (SONOFF_BN == Settings.module) { // PWM Single color led (White) - light_type = 1; + light_type = LT_PWM1; } else if (SONOFF_LED == Settings.module) { // PWM Dual color led (White warm and cold) - light_type = 2; + light_type = LT_PWM2; } else if (AILIGHT == Settings.module) { // RGBW led - light_type = 12; + light_type = LT_RGBW; } else if (SONOFF_B1 == Settings.module) { // RGBWC led - light_type = 13; + light_type = LT_RGBWC; } else { if (!light_type) { @@ -2603,7 +2609,7 @@ void GpioInit() #ifdef USE_WS2812 if (!light_type && (pin[GPIO_WS2812] < 99)) { // RGB led devices_present++; - light_type = 11; + light_type = LT_WS2812; } #endif // USE_WS2812 if (light_type) { // Any Led light under Dimmer/Color control diff --git a/sonoff/support.ino b/sonoff/support.ino index 6d8adecda..231b084cf 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -795,6 +795,17 @@ void I2cScan(char *devs, unsigned int devs_len) snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_NO_DEVICES_FOUND "\"}")); } } + +boolean I2cDevice(byte addr) +{ + for (byte address = 1; address <= 127; address++) { + Wire.beginTransmission(address); + if (!Wire.endTransmission() && (address == addr)) { + return true; + } + } + return false; +} #endif // USE_I2C /*********************************************************************************************\ @@ -1159,6 +1170,16 @@ double FastPrecisePow(double a, double b) return r * u.d; } +char* GetIndexedString(char* destination, const char* source, uint8_t index) +{ + strcpy_P(destination, source); // Copies Flash to Ram until end of string + char *indexed_string = strtok(destination, "|"); + while (index--) { + indexed_string = strtok(NULL, "|"); + } + return indexed_string; +} + /*********************************************************************************************\ * Syslog \*********************************************************************************************/ diff --git a/sonoff/user_config.h b/sonoff/user_config.h index 4510e228f..2c08a975b 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -44,7 +44,7 @@ // -- Wifi ---------------------------------------- #define WIFI_IP_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or IP address -#define WIFI_GATEWAY "192.168.2.254" // {IpAddress2] If not using DHCP set Gateway IP address +#define WIFI_GATEWAY "192.168.2.254" // [IpAddress2] If not using DHCP set Gateway IP address #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) @@ -167,6 +167,7 @@ #define USE_I2C // I2C using library wire (+10k code, 0.2k mem) - Disable by // #define USE_BH1750 // Add I2C code for BH1750 sensor +// #define USE_VEML6070 // Add I2C code for VEML6070 sensor (+0.5k code) #define USE_BMP // Add I2C code for BMP/BME280 sensor #define USE_HTU // Add I2C code for HTU21/SI7013/SI7020/SI7021 sensor #define USE_SHT // Add I2C emulating code for SHT1X sensor diff --git a/sonoff/webserver.ino b/sonoff/webserver.ino index ff2d915fc..a03b5d821 100644 --- a/sonoff/webserver.ino +++ b/sonoff/webserver.ino @@ -94,7 +94,7 @@ const char HTTP_HEAD[] PROGMEM = #ifdef BE_MINIMAL "