From 122b2a610c5ac0ba57cd663b39397a65660e910e Mon Sep 17 00:00:00 2001 From: arendst Date: Wed, 27 Dec 2017 14:10:55 +0100 Subject: [PATCH 1/3] v5.10.0d 5.10.0d * Renamed commands Color2,3,4 to Color3,4,5 * Add command Color2 to set color while keeping same dimmer value * Add led signal to Carbon Dioxide (CO2) sensors (see user_config.h) * Fix Wemo Emulation again (#1357) * Updated German translation (#1438) --- README.md | 2 +- sonoff/_releasenotes.ino | 9 ++++- sonoff/language/de-DE.h | 44 +++++++++++----------- sonoff/settings.h | 4 +- sonoff/sonoff.ino | 7 ++-- sonoff/user_config.h | 12 ++++-- sonoff/xdrv_light.ino | 55 ++++++++++++++++++++++----- sonoff/xdrv_wemohue.ino | 75 ++++++++++++++++++++----------------- sonoff/xsns_15_mhz19.ino | 10 ++++- sonoff/xsns_17_senseair.ino | 8 ++++ 10 files changed, 149 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index c2f88067f..5e05b13ae 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.10.0c** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.10.0d** - 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 bab94bd58..c3773add0 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,11 @@ -/* 5.10.0c +/* 5.10.0d + * Renamed commands Color2,3,4 to Color3,4,5 + * Add command Color2 to set color while keeping same dimmer value + * Add led signal to Carbon Dioxide (CO2) sensors (see user_config.h) + * Fix Wemo Emulation again (#1357) + * Updated German translation (#1438) + * + * 5.10.0c * Consolidate device serial (MH-Z19, SenseAir and Pzem004T) into TasmotaSerial library * Consolidate PWM device recognition * Fix Wemo Emulation (#1357) diff --git a/sonoff/language/de-DE.h b/sonoff/language/de-DE.h index 18a7a5d61..a89aa29e5 100644 --- a/sonoff/language/de-DE.h +++ b/sonoff/language/de-DE.h @@ -48,10 +48,10 @@ #define D_ACTIVE "aktiv" #define D_ADDRESS "Addresse" #define D_ADMIN "Admin" -#define D_AIR_QUALITY "Ausschlagsqualität" -#define D_AIRQUALITY "AusschlagsQualität" +#define D_AIR_QUALITY "Luftqualität" +#define D_AIRQUALITY "LuftQualität" #define D_AP "AP" // Access Point -#define D_APMAC_ADDRESS "APMac" +#define D_APMAC_ADDRESS "AP-Mac" #define D_APPENDED "angehängt" #define D_AS "wie" #define D_AUTO "AUTO" @@ -66,7 +66,7 @@ #define D_BUTTON "Knopf" #define D_BY "von" // Written by me #define D_CELSIUS "Celsius" -#define D_CO2 "Kohlenstoffdioxid" +#define D_CO2 "CO²" #define D_CODE "code" // Button code #define D_COLDLIGHT "kalt" #define D_COMMAND "Befehl" @@ -92,14 +92,14 @@ #define D_EVERY "alle" #define D_FAHRENHEIT "Fahrenheit" #define D_FAILED "fehlgeschlagen" -#define D_FALLBACK "Rückgriff" -#define D_FALLBACK_TOPIC "Rückgriff topic" -#define D_FALLBACKTOPIC "RückgriffTopic" +#define D_FALLBACK "Fallback" +#define D_FALLBACK_TOPIC "Fallback topic" +#define D_FALLBACKTOPIC "FallbackTopic" #define D_FALSE "falsch" #define D_FILE "Datei" #define D_FLASHMODE "FlashMode" #define D_FLASHSIZE "FlashSize" -#define D_FREE_MEMORY "Freier Speicher" +#define D_FREE_MEMORY "Freier Arbeitsspeicher" #define D_FREEMEMORY "frei" #define D_FROM "von" #define D_GAS "Gas" @@ -144,9 +144,9 @@ #define D_POWERUSAGE "Leistung" #define D_PRESSURE "Druck" #define D_PRESSUREATSEALEVEL "MeeresDruck" -#define D_PROGRAM_FLASH_SIZE "Programm Flash Größe" +#define D_PROGRAM_FLASH_SIZE "Ges. Flash Speicher" #define D_PROGRAMFLASHSIZE "ProgramFlashSize" -#define D_PROGRAM_SIZE "Programmgröße" +#define D_PROGRAM_SIZE "Ben. Flash Speicher" #define D_PROGRAMSIZE "ProgramSize" #define D_PROJECT "Projekt" #define D_RECEIVED "erhalten" @@ -170,7 +170,7 @@ #define D_STARTED "gestartet" #define D_STARTDST "StartDST" // Start Daylight Savings Time #define D_STD_TIME "STD" -#define D_STOP "stopp" +#define D_STOP "Stop" #define D_SUBNET_MASK "Subnetzmaske" #define D_SUBNETMASK "Subnetmaske" #define D_SUBSCRIBE_TO "subscribe to" @@ -244,7 +244,7 @@ #define D_CONNECT_FAILED_WRONG_PASSWORD "Verbindung fehlgeschlagen mit AP weil das Passwort falsch ist" #define D_CONNECT_FAILED_AP_TIMEOUT "Verbindung fehlgeschlagen da der AP nicht antwortet (timeout)" #define D_ATTEMPTING_CONNECTION "Verbindungsversuch..." -#define D_CHECKING_CONNECTION "prüfe Verbindung..." +#define D_CHECKING_CONNECTION "Prüfe Verbindung..." #define D_QUERY_DONE "Suchanfrage abgeschlossen. MQTT-Services gefunden" #define D_MQTT_SERVICE_FOUND "MQTT-Service gefunden bei" #define D_I2CSCAN_DEVICES_FOUND_AT "Gerät(e) gefunden bei" @@ -262,7 +262,7 @@ #define D_REDIRECTED "umgeleitet zu captive portal" #define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "WLAN-Manager AccessPoint gesetzt und behält Station" #define D_WIFIMANAGER_SET_ACCESSPOINT "WLAN-Manager AccessPoint gesetzt" -#define D_TRYING_TO_CONNECT "versuche Gerät mit Netzwerk zu verbinden" +#define D_TRYING_TO_CONNECT "Versuche Gerät mit Netzwerk zu verbinden" #define D_RESTART_IN "Neustart in" #define D_SECONDS "Sekunden" @@ -272,9 +272,9 @@ #define D_INFORMATION "Informationen" #define D_FIRMWARE_UPGRADE "Firmware Update" #define D_CONSOLE "Konsole" -#define D_CONFIRM_RESTART "Neustart bestätigen" +#define D_CONFIRM_RESTART "Wirklich neustarten?" -#define D_CONFIGURE_MODULE "Modul konfigurieren" +#define D_CONFIGURE_MODULE "Gerät konfigurieren" #define D_CONFIGURE_WIFI "WLAN konfigurieren" #define D_CONFIGURE_MQTT "MQTT konfigurieren" #define D_CONFIGURE_DOMOTICZ "Domoticz konfigurieren" @@ -286,8 +286,8 @@ #define D_RESTORE_CONFIGURATION "Konfiguration wiederherstellen" #define D_MAIN_MENU "Hauptmenü" -#define D_MODULE_PARAMETERS "Modul Einstellungen" -#define D_MODULE_TYPE "Modul Typ" +#define D_MODULE_PARAMETERS "Geräte Einstellungen" +#define D_MODULE_TYPE "Geräte Typ" #define D_GPIO "GPIO" #define D_SERIAL_IN "serieller Eingang [serial in]" #define D_SERIAL_OUT "serieller Ausgang [serial out]" @@ -315,8 +315,8 @@ #define D_LOGGING_PARAMETERS "Logging Einstellungen" #define D_LOG_LEVEL "Log level" #define D_MORE_DEBUG "More debug" -#define D_SYSLOG_HOST "Syslog Host" -#define D_SYSLOG_PORT "Syslog Port" +#define D_SYSLOG_HOST "Sys Log Host" +#define D_SYSLOG_PORT "Sys Log Port" #define D_TELEMETRY_PERIOD "Telemetry period" #define D_OTHER_PARAMETERS "Sonstige Einstellungen" @@ -348,8 +348,8 @@ #define D_MDNS_ADVERTISE "mDNS-Bekanntmachung" #define D_ESP_CHIP_ID "ESP Chip ID" #define D_FLASH_CHIP_ID "Flash Chip ID" -#define D_FLASH_CHIP_SIZE "Flash Größe" -#define D_FREE_PROGRAM_SPACE "Freier Programm Speicher" +#define D_FLASH_CHIP_SIZE "Realer Flash Speicher" +#define D_FREE_PROGRAM_SPACE "Verf. Flash Speicher" #define D_UPGRADE_BY_WEBSERVER "Update über Web-Server" #define D_OTA_URL "OTA-URL" @@ -370,7 +370,7 @@ #define D_UPLOAD_ERROR_CODE "Upload Fehler Nummer" #define D_ENTER_COMMAND "Befehl eingeben" -#define D_ENABLE_WEBLOG_FOR_RESPONSE "aktivere weblog 2 falls Reaktion erwartet" +#define D_ENABLE_WEBLOG_FOR_RESPONSE "Aktivere Web Log Level 2 falls Reaktion erwartet" #define D_NEED_USER_AND_PASSWORD "Benutzer benötigt=&password=" // xdrv_domoticz.ino diff --git a/sonoff/settings.h b/sonoff/settings.h index b718bf005..4c549e6c7 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -43,9 +43,9 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t pwm_control : 1; // bit 15 (v5.8.1) uint32_t ws_clock_reverse : 1; // bit 16 (v5.8.1) uint32_t decimal_text : 1; // bit 17 (v5.8.1) - uint32_t spare18 : 1; + uint32_t light_signal : 1; // bit 18 (v5.10.0c) uint32_t spare19 : 1; - uint32_t voltage_resolution : 1; + uint32_t voltage_resolution : 1; // Replaced by below uint32_t spare21 : 1; uint32_t spare22 : 1; uint32_t spare23 : 1; diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index a08318e2a..770aab982 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,8 +25,8 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x050A0003 -#define VERSION_STRING "5.10.0c" // Would be great to have a macro that fills this from VERSION ... +#define VERSION 0x050A0004 +#define VERSION_STRING "5.10.0d" // Would be great to have a macro that fills this from VERSION ... // Location specific includes #include "sonoff.h" // Enumaration used in user_config.h @@ -986,7 +986,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len) } snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, (Settings.save_data > 1) ? stemp1 : GetStateText(Settings.save_data)); } - else if ((CMND_SETOPTION == command_code) && ((index >= 0) && (index <= 17)) || ((index > 31) && (index <= P_MAX_PARAM8 +31))) { + else if ((CMND_SETOPTION == command_code) && ((index >= 0) && (index <= 18)) || ((index > 31) && (index <= P_MAX_PARAM8 +31))) { if (index <= 31) { ptype = 0; // SetOption0 .. 31 } else { @@ -1012,6 +1012,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len) case 14: // interlock case 16: // ws_clock_reverse case 17: // decimal_text + case 18: // light_signal bitWrite(Settings.flag.data, index, payload); } if (12 == index) { // stop_flash_rotate diff --git a/sonoff/user_config.h b/sonoff/user_config.h index dbeb0cca9..263bbdce6 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -163,12 +163,13 @@ // -- Sensor code selection ----------------------- #define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices -//#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code) +#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code) // WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors //#define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) //#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code) +// -- I2C sensors --------------------------------- #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 based on Adafruit (+0k7 code) @@ -184,6 +185,12 @@ // #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) +// -- Carbon dioxide (CO2) sensors ---------------- +#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) + #define CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) + #define CO2_HIGH 1200 // Above this CO2 value show red light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1) + #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) @@ -192,9 +199,6 @@ #define USE_WS2812_CTYPE 1 // WS2812 Color type (0 - RGB, 1 - GRB, 2 - RGBW, 3 - GRBW) // #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow -//#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) - #define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code) /*********************************************************************************************\ diff --git a/sonoff/xdrv_light.ino b/sonoff/xdrv_light.ino index 3b82f74cf..9d79eb26c 100644 --- a/sonoff/xdrv_light.ino +++ b/sonoff/xdrv_light.ino @@ -93,6 +93,7 @@ uint8_t light_entry_color[5]; uint8_t light_current_color[5]; uint8_t light_new_color[5]; uint8_t light_last_color[5]; +uint8_t light_signal_color[5]; uint8_t light_wheel = 0; uint8_t light_subtype = 0; @@ -451,7 +452,11 @@ void LightSetDimmer(uint8_t myDimmer) } float dimmer = 100 / (float)myDimmer; for (byte i = 0; i < light_subtype; i++) { - temp = (float)Settings.light_color[i] / dimmer; + if (Settings.flag.light_signal) { + temp = (float)light_signal_color[i] / dimmer; + } else { + temp = (float)Settings.light_color[i] / dimmer; + } light_current_color[i] = (uint8_t)temp; } } @@ -474,6 +479,34 @@ void LightSetColor() } } +void LightSetSignal(uint16_t lo, uint16_t hi, uint16_t value) +{ +/* lo - below lo is green + hi - above hi is red +*/ + if (Settings.flag.light_signal) { + uint16_t signal = 0; + if (value > lo) { + signal = (value - lo) * 10 / ((hi - lo) * 10 / 256); + if (signal > 255) { + signal = 255; + } + } +// snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_DEBUG "Light signal %d"), signal); +// AddLog(LOG_LEVEL_DEBUG); + light_signal_color[0] = signal; + light_signal_color[1] = 255 - signal; + light_signal_color[2] = 0; + light_signal_color[3] = 0; + light_signal_color[4] = 0; + + Settings.light_scheme = 0; + if (!Settings.light_dimmer) { + Settings.light_dimmer = 20; + } + } +} + char* LightGetColor(uint8_t type, char* scolor) { LightSetDimmer(Settings.light_dimmer); @@ -969,32 +1002,36 @@ boolean LightCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_le char option = (1 == data_len) ? dataBuf[0] : '\0'; int command_code = GetCommandCode(command, sizeof(command), type, kLightCommands); - if ((CMND_COLOR == command_code) && (light_subtype > LST_SINGLE) && (index > 0) && (index <= 4)) { + if ((CMND_COLOR == command_code) && (light_subtype > LST_SINGLE) && (index > 0) && (index <= 5)) { if (data_len > 0) { valid_entry = LightColorEntry(dataBuf, data_len); if (valid_entry) { - if (1 == index) { // Color(1) + if (index <= 2) { // Color(1), 2 memcpy(light_current_color, light_entry_color, sizeof(light_current_color)); + uint8_t dimmer = Settings.light_dimmer; LightSetColor(); + if (2 == index) { + Settings.light_dimmer = dimmer; + } Settings.light_scheme = 0; coldim = true; - } else { // Color2, 3 and 4 + } else { // Color3, 4 and 5 for (byte i = 0; i < LST_RGB; i++) { - Settings.ws_color[index -2][i] = light_entry_color[i]; + Settings.ws_color[index -3][i] = light_entry_color[i]; } } } } - if (!valid_entry && (1 == index)) { + if (!valid_entry && (index <= 2)) { snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, LightGetColor(0, scolor)); } - if (index > 1) { + if (index >= 3) { scolor[0] = '\0'; for (byte i = 0; i < LST_RGB; i++) { if (Settings.flag.decimal_text) { - snprintf_P(scolor, 25, PSTR("%s%s%d"), scolor, (i > 0) ? "," : "", Settings.ws_color[index -2][i]); + snprintf_P(scolor, 25, PSTR("%s%s%d"), scolor, (i > 0) ? "," : "", Settings.ws_color[index -3][i]); } else { - snprintf_P(scolor, 25, PSTR("%s%02X"), scolor, Settings.ws_color[index -2][i]); + snprintf_P(scolor, 25, PSTR("%s%02X"), scolor, Settings.ws_color[index -3][i]); } } snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, command, index, scolor); diff --git a/sonoff/xdrv_wemohue.ino b/sonoff/xdrv_wemohue.ino index 082360235..e441cf513 100755 --- a/sonoff/xdrv_wemohue.ino +++ b/sonoff/xdrv_wemohue.ino @@ -241,43 +241,51 @@ void PollUdp() \*********************************************************************************************/ const char WEMO_EVENTSERVICE_XML[] PROGMEM = - "" - "" - "" - "SetBinaryState" - "" - "" - "" - "BinaryState" - "BinaryState" - "in" - "" - "" - "" - "" - "BinaryState" - "Boolean" - "0" - "" - "" - "level" - "string" - "0" - "" - "" - "" - "\r\n" - "\r\n"; + // XosePerez version 20171108 - v2.3.0 + "" + "" + "10" + "" + "" + "SetBinaryState" + "" + "" + "" + "BinaryState" + "BinaryState" + "in" + "" + "" + "" + "" + "GetBinaryState" + "" + "" + "" + "BinaryState" + "BinaryState" + "out" + "" + "" + "" + "" + "" + "" + "BinaryState" + "Boolean" + "0" + "" + "" + ""; const char WEMO_RESPONSE_STATE_SOAP[] PROGMEM = "" "" - "" + "" "{x1" - "" + "" "" - "\r\n" - "\r\n"; + ""; const char WEMO_SETUP_XML[] PROGMEM = "" @@ -301,8 +309,7 @@ const char WEMO_SETUP_XML[] PROGMEM = "" "" "" - "\r\n" - "\r\n"; + ""; /********************************************************************************************/ @@ -321,7 +328,7 @@ void HandleUpnpEvent() } } else if(request.indexOf(F("GetBinaryState")) > 0){ - state_xml.replace("Set", "Get"); + state_xml.replace(F("SetBinaryState"), F("GetBinaryStateResponse")); } state_xml.replace("{x1", String(bitRead(power, devices_present -1))); WebServer->send(200, FPSTR(HDR_CTYPE_XML), state_xml); diff --git a/sonoff/xsns_15_mhz19.ino b/sonoff/xsns_15_mhz19.ino index 7f5e56aa8..859f19c56 100644 --- a/sonoff/xsns_15_mhz19.ino +++ b/sonoff/xsns_15_mhz19.ino @@ -54,11 +54,18 @@ enum MhzFilterOptions {MHZ19_FILTER_OFF, MHZ19_FILTER_OFF_ALLSAMPLES, MHZ19_FILT #include -TasmotaSerial *MhzSerial; +#ifndef CO2_LOW +#define CO2_LOW 800 // Below this CO2 value show green light +#endif +#ifndef CO2_HIGH +#define CO2_HIGH 1200 // Above this CO2 value show red light +#endif #define MHZ19_READ_TIMEOUT 500 // Must be way less than 1000 #define MHZ19_RETRY_COUNT 8 +TasmotaSerial *MhzSerial; + const char kMhzTypes[] PROGMEM = "MHZ19|MHZ19B"; const uint8_t mhz_cmnd_read_ppm[9] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}; @@ -180,6 +187,7 @@ void Mhz50ms() mhz_type = (s) ? 1 : 2; if (MhzCheckAndApplyFilter(ppm, s)) { mhz_retry = MHZ19_RETRY_COUNT; + LightSetSignal(CO2_LOW, CO2_HIGH, mhz_last_ppm); if (0 == s || 64 == s) { // Reading is stable. if (mhz_abc_must_apply) { diff --git a/sonoff/xsns_17_senseair.ino b/sonoff/xsns_17_senseair.ino index c3457af18..6b23a5a69 100644 --- a/sonoff/xsns_17_senseair.ino +++ b/sonoff/xsns_17_senseair.ino @@ -26,6 +26,13 @@ #include +#ifndef CO2_LOW +#define CO2_LOW 800 // Below this CO2 value show green light +#endif +#ifndef CO2_HIGH +#define CO2_HIGH 1200 // Above this CO2 value show red light +#endif + TasmotaSerial *SensairSerial; const char kSenseairTypes[] PROGMEM = "Kx0|S8"; @@ -131,6 +138,7 @@ void Senseair50ms() // Every 50 mSec break; case 2: // 0x03 (3) READ_CO2 - fe 04 02 06 2c af 59 senseair_co2 = value; + LightSetSignal(CO2_LOW, CO2_HIGH, senseair_co2); break; case 3: // 0x04 (4) READ_TEMPERATURE - S8: fe 84 02 f2 f1 - Illegal Data Address senseair_temperature = ConvertTemp((float)value / 100); From 20619ac41b43adf885e75e66ef8759c69457fea9 Mon Sep 17 00:00:00 2001 From: arendst Date: Thu, 28 Dec 2017 13:43:51 +0100 Subject: [PATCH 2/3] v5.10.0e 5.10.0e * Add Italian language file (#1449) * Fix Wemo Emulation once again closest to issue (#1357) --- README.md | 12 +- platformio.ini | 27 +- sonoff/_releasenotes.ino | 6 +- sonoff/language/it-IT.h | 710 +++++++++++++++++++++++++++++++++++++++ sonoff/settings.ino | 6 +- sonoff/sonoff.ino | 4 +- sonoff/user_config.h | 3 +- sonoff/xdrv_wemohue.ino | 90 ++++- 8 files changed, 843 insertions(+), 15 deletions(-) create mode 100644 sonoff/language/it-IT.h diff --git a/README.md b/README.md index 5e05b13ae..1fac28e61 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.10.0d** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. +Current version is **5.10.0e** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information. ### ATTENTION All versions @@ -42,6 +42,7 @@ The following devices are supported: - [iTead Sonoff 4CH](https://www.itead.cc/smart-home/sonoff-4ch.html) - [iTead Sonoff 4CH Pro](https://www.itead.cc/smart-home/sonoff-4ch-pro.html) - [iTead S20 Smart Socket](https://www.itead.cc/smart-socket.html) +- [Sonoff S22 Smart Socket](https://github.com/arendst/Sonoff-Tasmota/issues/627) - [iTead Slampher](https://www.itead.cc/slampher.html) - [iTead Sonoff Touch](https://www.itead.cc/sonoff-touch.html) - [iTead Sonoff T1](https://www.itead.cc/sonoff-t1.html) @@ -54,8 +55,13 @@ The following devices are supported: - [iTead 1 Channel Switch 5V / 12V](https://www.itead.cc/smart-home/inching-self-locking-wifi-wireless-switch.html) - [iTead Motor Clockwise/Anticlockwise](https://www.itead.cc/smart-home/motor-reversing-wifi-wireless-switch.html) - [Electrodragon IoT Relay Board](http://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/) -- [AI Light or any my9291 compatible RGBW LED](http://www.ebay.com/itm/172644855726) -- MagicHome and AriLux AL-LC01 and AL-LC11 +- AI Light or any my9291 compatible RGBW LED bulb +- H801 PWM LED controller +- [MagicHome PWM LED controller](https://github.com/arendst/Sonoff-Tasmota/wiki/MagicHome-LED-strip-controller) +- AriLux AL-LC01, AL-LC06 and AL-LC11 PWM LED controller +- [Supla device - Espablo-inCan mod. for electrical Installation box](https://forum.supla.org/viewtopic.php?f=33&t=2188) +- [Luani HVIO board](https://luani.de/projekte/esp8266-hvio/) +- Wemos D1 mini and NodeMcu ### License diff --git a/platformio.ini b/platformio.ini index a105642b9..da811a266 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,6 +15,8 @@ src_dir = sonoff ;env_default = sonoff-NL ;env_default = sonoff-DE ;env_default = sonoff-PL +;env_default = sonoff-IT +;env_default = sonoff-emulation ;env_default = sonoff-minimal ;env_default = sonoff-ds18x20 @@ -73,8 +75,31 @@ lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON ; *** Serial Monitor options monitor_baud = 115200 +[env:sonoff-IT] +platform = espressif8266 +framework = arduino +board = esp01_1m +board_flash_mode = dout +build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DMY_LANGUAGE=it-IT +lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON + +; *** Serial Monitor options +monitor_baud = 115200 + +; Sonoff with Wemo and Hue emulation +[env:sonoff-emulation] +platform = espressif8266 +framework = arduino +board = esp01_1m +board_flash_mode = dout +build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DUSE_EMULATION +lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON + +; Serial Monitor options +monitor_baud = 115200 + ; Sonoff minimal -[env:sonoff-minimal] ; Placeholder to be configured +[env:sonoff-minimal] platform = espressif8266 framework = arduino board = esp01_1m diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index c3773add0..5a7640f9e 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,8 @@ -/* 5.10.0d +/* 5.10.0e + * Add Italian language file (#1449) + * Fix Wemo Emulation once again closest to issue (#1357) + * + * 5.10.0d * Renamed commands Color2,3,4 to Color3,4,5 * Add command Color2 to set color while keeping same dimmer value * Add led signal to Carbon Dioxide (CO2) sensors (see user_config.h) diff --git a/sonoff/language/it-IT.h b/sonoff/language/it-IT.h new file mode 100644 index 000000000..63c3ca0e9 --- /dev/null +++ b/sonoff/language/it-IT.h @@ -0,0 +1,710 @@ +/* + it-IT.h - localization for Italian - Italy for Sonoff-Tasmota + + Copyright (C) 2018 Gennaro Tortone + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _LANGUAGE_IT_IT_H_ +#define _LANGUAGE_IT_IT_H_ + +/*************************** ATTENTION *******************************\ + * + * Due to memory constraints only UTF-8 is supported. + * To save code space keep text as short as possible. + * Time and Date provided by SDK can not be localized (yet). + * Use online command StateText to translate ON, OFF, HOLD and TOGGLE. + * Use online command Prefix to translate cmnd, stat and tele. + * +\*********************************************************************/ + +// "2017-03-07T11:08:02" - ISO8601:2004 +#define D_YEAR_MONTH_SEPARATOR "-" +#define D_MONTH_DAY_SEPARATOR "-" +#define D_DATE_TIME_SEPARATOR "T" +#define D_HOUR_MINUTE_SEPARATOR ":" +#define D_MINUTE_SECOND_SEPARATOR ":" + +#define D_DAY3LIST "DomLunMarMerGioVenSab" +#define D_MONTH3LIST "GenFebMarAprMagGiuLugAgoSetOttNovDic" + +// Non JSON decimal separator +#define D_DECIMAL_SEPARATOR "." + +// Common +#define D_ABORTED "Aborted" +#define D_ACTIVE "Active" +#define D_ADDRESS "Address" +#define D_ADMIN "Admin" +#define D_AIR_QUALITY "Qualita' dell'aria" +#define D_AIRQUALITY "AirQuality" +#define D_AP "AP" // Access Point +#define D_APMAC_ADDRESS "APMac" +#define D_APPENDED "Appended" +#define D_AS "come" +#define D_AUTO "AUTO" +#define D_BAUDRATE "Baudrate" +#define D_BLINK "Blink" +#define D_BLINKOFF "BlinkOff" +#define D_BOOTVERSION "Boot" +#define D_BOOT_COUNT "Boot Count" +#define D_BOOTCOUNT "BootCount" +#define D_BRIGHTLIGHT "Luminoso" +#define D_BUILDDATETIME "BuildDateTime" +#define D_BUTTON "Pulsante" +#define D_BY "da" // Written by me +#define D_CELSIUS "Celsius" +#define D_CO2 "CO2" +#define D_CODE "codice" // Button code +#define D_COLDLIGHT "Fredda" +#define D_COMMAND "Command" +#define D_CONNECTED "Connesso" +#define D_COREVERSION "Core" +#define D_COUNT "Conteggio" +#define D_COUNTER "Counter" +#define D_CURRENT "Current" // As in Voltage and Current +#define D_DATA "Data" +#define D_DARKLIGHT "Scuro" +#define D_DEBUG "Debug" +#define D_DISABLED "Disabilitato" +#define D_DNS_SERVER "DNS Server" +#define D_DNSSERVER "DNSServer" +#define D_DONE "Done" +#define D_DST_TIME "DST" +#define D_EMPTY "Empty" +#define D_EMULATION "Emulazione" +#define D_ENABLED "Abilitato" +#define D_ENDDST "EndDST" // End Daylight Savings Time +#define D_ERASE "Erase" +#define D_ERROR "Error" +#define D_EVERY "Ogni" +#define D_FAHRENHEIT "Fahrenheit" +#define D_FAILED "Fallito" +#define D_FALLBACK "Fallback" +#define D_FALLBACK_TOPIC "Topic Riserva" +#define D_FALLBACKTOPIC "FallbackTopic" +#define D_FALSE "False" +#define D_FILE "File" +#define D_FLASHMODE "FlashMode" +#define D_FLASHSIZE "FlashSize" +#define D_FREE_MEMORY "Memoria Libera" +#define D_FREEMEMORY "Free" +#define D_FROM "from" +#define D_GAS "Gas" +#define D_GATEWAY "Gateway" +#define D_GROUP "Gruppo" +#define D_HEAPSIZE "Heap" +#define D_HIGH "High" +#define D_HOST "Host" +#define D_HOSTNAME "Hostname" +#define D_HUMIDITY "Humidity" +#define D_ID "Id" +#define D_ILLUMINANCE "Illuminazione" +#define D_IMMEDIATE "immediato" // Button immediate +#define D_INDEX "Index" +#define D_INFO "Info" +#define D_INITIALIZED "Inizializzato" +#define D_IP_ADDRESS "Indirizzo IP" +#define D_LIGHT "Light" +#define D_LIMIT "Limit" +#define D_LOCAL_TIME "Local" +#define D_LOW "Low" +#define D_LWT "LWT" +#define D_MAC "Mac" +#define D_MASK "Mask" +#define D_MODULE "Module" +#define D_MQTT "MQTT" +#define D_MULTI_PRESS "multi-pressione" +#define D_NO "No" +#define D_NOISE "Noise" +#define D_NONE "Nessuno" +#define D_OFF "Off" +#define D_OFFLINE "Offline" +#define D_OK "Ok" +#define D_ON "On" +#define D_ONLINE "Online" +#define D_OR "or" +#define D_PASSWORD "Password" +#define D_PERIOD "Period" +#define D_PORT "Porta" +#define D_POWER_FACTOR "Fattore di potenza" +#define D_POWERFACTOR "Factor" +#define D_POWERUSAGE "Power" +#define D_PRESSURE "Pressure" +#define D_PRESSUREATSEALEVEL "SeaPressure" +#define D_PROGRAM_FLASH_SIZE "Dimensione Flash Programma" +#define D_PROGRAMFLASHSIZE "ProgramFlashSize" +#define D_PROGRAM_SIZE "Dimensione Programma" +#define D_PROGRAMSIZE "ProgramSize" +#define D_PROJECT "Project" +#define D_RECEIVED "Ricevuto" +#define D_RESTART "Riavvio" +#define D_RESTARTING "Restarting" +#define D_RESTART_REASON "Causa Riavvio" +#define D_RESTARTREASON "RestartReason" +#define D_RESTORE "ripristino" +#define D_RETAINED "salvato" +#define D_SAVE "Salva" +#define D_SAVEADDRESS "SaveAddress" +#define D_SAVECOUNT "SaveCount" +#define D_SAVESTATE "SaveState" +#define D_SDKVERSION "SDK" +#define D_SELECTED "selected" +#define D_SENSOR "Sensore" +#define D_SERIAL "Seriale" +#define D_BYTES "Bytes" +#define D_SSID "SSId" +#define D_START "Start" +#define D_STARTED "Started" +#define D_STARTDST "StartDST" // Start Daylight Savings Time +#define D_STD_TIME "STD" +#define D_STOP "Stop" +#define D_SUBNET_MASK "Maschera sottorete" +#define D_SUBNETMASK "Subnetmask" +#define D_SUBSCRIBE_TO "Sottoscrivi a" +#define D_SUCCESSFUL "Successful" +#define D_SWITCH "Switch" +#define D_SYNC "Sync" +#define D_SYS "Sys" // Sys log +#define D_TEMPERATURE "Temperature" +#define D_TEMPERATURE_UNIT "TempUnit" +#define D_TIME "Time" +#define D_TO "a" +#define D_TODAY "Today" +#define D_TOGGLE "Toggle" +#define D_TOPIC "Topic" +#define D_TOTAL "Total" +#define D_TRANSMIT "Trasmesso" +#define D_TRUE "True" +#define D_TYPE "Type" +#define D_UNKNOWN "Unknown" +#define D_UPGRADE "aggiornamento" +#define D_UPLOAD "Invio" +#define D_UPTIME "Uptime" +#define D_USER "Utente" +#define D_UTC_TIME "UTC" +#define D_UV_LEVEL "UV Level" +#define D_VCC "Vcc" +#define D_VERSION "Version" +#define D_VOLTAGE "Voltage" +#define D_WARMLIGHT "Calda" +#define D_WEB "Web" // Web log +#define D_WEB_SERVER "Web Server" +#define D_WIFI "Wifi" +#define D_WRONG "Wrong" +#define D_YESTERDAY "Yesterday" + +// settings.ino +#define D_SAVED_TO_FLASH_AT "Salvato nella flash in" +#define D_LOADED_FROM_FLASH_AT "Caricato dalla flash da" +#define D_USE_DEFAULTS "Utilizzo valori default" +#define D_ERASED_SECTOR "Settore cancellato" + +// sonoff.ino +#define D_LEVEL_10 "level 1-0" +#define D_LEVEL_01 "level 0-1" +#define D_SERIAL_LOGGING_DISABLED "Log seriale disabilitato" +#define D_SYSLOG_LOGGING_REENABLED "Syslog ri-abilitato" + +#define D_SET_BAUDRATE_TO "Baudrate impostato a" +#define D_RECEIVED_TOPIC "Topic Ricevuto" +#define D_DATA_SIZE "Dimensione Dati" +#define D_ANALOG_INPUT "Analogico" + +#define D_FINGERPRINT "Verifica TLS fingerprint..." +#define D_TLS_CONNECT_FAILED_TO "Connessione TLS fallita a" +#define D_RETRY_IN "Nuovo tentativo in" +#define D_VERIFIED "Verificato" +#define D_INSECURE "Connessione insicura a causa di Fingerprint non valido" +#define D_CONNECT_FAILED_TO "Connessione Fallita a" + +// support.ino +#define D_OSWATCH "osWatch" +#define D_BLOCKED_LOOP "Ciclo Bloccato" +#define D_WPS_FAILED_WITH_STATUS "WPSconfig Fallito con stato" +#define D_ACTIVE_FOR_3_MINUTES "attivo per 3 minuti" +#define D_FAILED_TO_START "partenza fallita" +#define D_PATCH_ISSUE_2186 "Patch issue 2186" +#define D_CONNECTING_TO_AP "Connessione ad AP" +#define D_IN_MODE "in modalita'" +#define D_CONNECT_FAILED_NO_IP_ADDRESS "Connessione fallita, indirizzo IP non ricevuto" +#define D_CONNECT_FAILED_AP_NOT_REACHED "Connessione fallita, AP non raggiungibile" +#define D_CONNECT_FAILED_WRONG_PASSWORD "Connessione fallita, password AP non corretta" +#define D_CONNECT_FAILED_AP_TIMEOUT "Connessione fallita, timeout AP" +#define D_ATTEMPTING_CONNECTION "Tentativo di connessione..." +#define D_CHECKING_CONNECTION "Controllo connessione..." +#define D_QUERY_DONE "Query eseguita. Servizio MQTT trovato" +#define D_MQTT_SERVICE_FOUND "Servizio MQTT trovato su" +#define D_I2CSCAN_DEVICES_FOUND_AT "Dispositivo/i trovato a" +#define D_FOUND_AT "trovato a" +#define D_I2CSCAN_UNKNOWN_ERROR_AT "Errore sconosciuto a" +#define D_I2CSCAN_NO_DEVICES_FOUND "Nessun dispositivo trovato" +#define D_SYSLOG_HOST_NOT_FOUND "Syslog Host non trovato" + +// webserver.ino +#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "MINIMAL firmware - effettuare aggiornamento" +#define D_WEBSERVER_ACTIVE_ON "Web server attivo su" +#define D_WITH_IP_ADDRESS "con indirizzo IP" +#define D_WEBSERVER_STOPPED "Web server arrestato" +#define D_FILE_NOT_FOUND "File Non Trovato" +#define D_REDIRECTED "Redirezione al captive portal" +#define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "Impostazione Wifimanager come AccessPoint e Station" +#define D_WIFIMANAGER_SET_ACCESSPOINT "Impostazione Wifimanager come AccessPoint" +#define D_TRYING_TO_CONNECT "Tentativo di connessione del dispositivo alla rete" + +#define D_RESTART_IN "Riavvio in" +#define D_SECONDS "secondi" +#define D_DEVICE_WILL_RESTART "Il dispositivo verra' riavviato tra pochi secondi" +#define D_BUTTON_TOGGLE "On/Off" +#define D_CONFIGURATION "Configurazione" +#define D_INFORMATION "Informazioni" +#define D_FIRMWARE_UPGRADE "Aggiornamento Firmware" +#define D_CONSOLE "Console" +#define D_CONFIRM_RESTART "Conferma Riavvio" + +#define D_CONFIGURE_MODULE "Configurazione Modulo" +#define D_CONFIGURE_WIFI "Configurazione WiFi" +#define D_CONFIGURE_MQTT "Configurazione MQTT" +#define D_CONFIGURE_DOMOTICZ "Configurazione Domoticz" +#define D_CONFIGURE_LOGGING "Configurazione Logging" +#define D_CONFIGURE_OTHER "Configurazione Extra" +#define D_CONFIRM_RESET_CONFIGURATION "Conferma Reset Configurazione" +#define D_RESET_CONFIGURATION "Reset Configurazione" +#define D_BACKUP_CONFIGURATION "Backup Configurazione" +#define D_RESTORE_CONFIGURATION "Ripristino Configurazione" +#define D_MAIN_MENU "Menu' Principale" + +#define D_MODULE_PARAMETERS "Parametri del modulo" +#define D_MODULE_TYPE "Tipo modulo" +#define D_GPIO "GPIO" +#define D_SERIAL_IN "Serial In" +#define D_SERIAL_OUT "Serial Out" + +#define D_WIFI_PARAMETERS "Parametri Wifi" +#define D_SCAN_FOR_WIFI_NETWORKS "Scansione delle reti wifi" +#define D_SCAN_DONE "Scansione effettuata" +#define D_NO_NETWORKS_FOUND "Nessuna rete trovata" +#define D_REFRESH_TO_SCAN_AGAIN "Ricarica per nuova scansione" +#define D_DUPLICATE_ACCESSPOINT "AccessPoint duplicato" +#define D_SKIPPING_LOW_QUALITY "Ignorato a causa di bassa qualita'" +#define D_RSSI "RSSI" +#define D_WEP "WEP" +#define D_WPA_PSK "WPA PSK" +#define D_WPA2_PSK "WPA2 PSK" +#define D_AP1_SSID "AP1 SSId" +#define D_AP1_PASSWORD "AP1 Password" +#define D_AP2_SSID "AP2 SSId" +#define D_AP2_PASSWORD "AP2 Password" + +#define D_MQTT_PARAMETERS "Parametri MQTT" +#define D_CLIENT "Client" +#define D_FULL_TOPIC "Full Topic" + +#define D_LOGGING_PARAMETERS "Parametri Logging" +#define D_LOG_LEVEL "livello di log" +#define D_MORE_DEBUG "Debug aggiuntivo" +#define D_SYSLOG_HOST "Syslog host" +#define D_SYSLOG_PORT "Syslog porta" +#define D_TELEMETRY_PERIOD "Periodo Telemetria" + +#define D_OTHER_PARAMETERS "Altri parametri" +#define D_WEB_ADMIN_PASSWORD "Password Amministratore Web" +#define D_MQTT_ENABLE "Abilita MQTT" +#define D_FRIENDLY_NAME "Nome confidenziale" +#define D_BELKIN_WEMO "Belkin WeMo" +#define D_HUE_BRIDGE "Hue Bridge" +#define D_SINGLE_DEVICE "dispositivo singolo" +#define D_MULTI_DEVICE "dispositivo multiplo" + +#define D_SAVE_CONFIGURATION "Salva configurazione" +#define D_CONFIGURATION_SAVED "Configurazione salvata" +#define D_CONFIGURATION_RESET "Configurazione azzerata" + +#define D_PROGRAM_VERSION "Versione del programma" +#define D_BUILD_DATE_AND_TIME "Data e ora compilazione" +#define D_CORE_AND_SDK_VERSION "Versione Core/SDK" +#define D_FLASH_WRITE_COUNT "Contatore scrittura Flash" +#define D_MAC_ADDRESS "Indirizzo MAC" +#define D_MQTT_HOST "MQTT Host" +#define D_MQTT_PORT "MQTT Porta" +#define D_MQTT_CLIENT "MQTT Client" +#define D_MQTT_USER "MQTT Utente" +#define D_MQTT_TOPIC "MQTT Topic" +#define D_MQTT_GROUP_TOPIC "MQTT Group Topic" +#define D_MQTT_FULL_TOPIC "MQTT Full Topic" +#define D_MDNS_DISCOVERY "mDNS Discovery" +#define D_MDNS_ADVERTISE "mDNS Advertise" +#define D_ESP_CHIP_ID "ESP Chip Id" +#define D_FLASH_CHIP_ID "Flash Chip Id" +#define D_FLASH_CHIP_SIZE "Dimensione Flash" +#define D_FREE_PROGRAM_SPACE "Spazio Libero Memoria Programma" + +#define D_UPGRADE_BY_WEBSERVER "Aggiornamento da web server" +#define D_OTA_URL "OTA Url" +#define D_START_UPGRADE "Avvio aggiornamento" +#define D_UPGRADE_BY_FILE_UPLOAD "Aggiornamento tramite invio file" +#define D_UPLOAD_STARTED "Invio iniziato" +#define D_UPGRADE_STARTED "Aggiornamento avviato" +#define D_UPLOAD_DONE "Invio effettuato" +#define D_UPLOAD_ERR_1 "Nessun file selezionato" +#define D_UPLOAD_ERR_2 "Spazio insufficiente" +#define D_UPLOAD_ERR_3 "Magic byte non corrispondente a 0xE9" +#define D_UPLOAD_ERR_4 "Dimensione della memoria programma maggiore della dimensione reale della flash" +#define D_UPLOAD_ERR_5 "Errore di comparazione del buffer di invio" +#define D_UPLOAD_ERR_6 "Invio fallito. Abilitare logging 3" +#define D_UPLOAD_ERR_7 "Invio annullato" +#define D_UPLOAD_ERR_8 "File non valido" +#define D_UPLOAD_ERR_9 "File troppo grande" +#define D_UPLOAD_ERROR_CODE "Codice errore invio" + +#define D_ENTER_COMMAND "Inserire comando" +#define D_ENABLE_WEBLOG_FOR_RESPONSE "Abilitare weblog 2 se e' attesa una risposta" +#define D_NEED_USER_AND_PASSWORD "Richiesto user=&password=" + +// xdrv_domoticz.ino +#define D_DOMOTICZ_PARAMETERS "Parametri Domoticz" +#define D_DOMOTICZ_IDX "Idx" +#define D_DOMOTICZ_KEY_IDX "Key idx" +#define D_DOMOTICZ_SWITCH_IDX "Switch idx" +#define D_DOMOTICZ_SENSOR_IDX "Sensor idx" + #define D_DOMOTICZ_TEMP "Temp" + #define D_DOMOTICZ_TEMP_HUM "Temp,Hum" + #define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Hum,Baro" + #define D_DOMOTICZ_POWER_ENERGY "Power,Energy" + #define D_DOMOTICZ_ILLUMINANCE "Illuminance" + #define D_DOMOTICZ_COUNT "Count" + #define D_DOMOTICZ_VOLTAGE "Voltage" + #define D_DOMOTICZ_CURRENT "Current" + #define D_DOMOTICZ_AIRQUALITY "AirQuality" +#define D_DOMOTICZ_UPDATE_TIMER "Intervallo di aggiornamento" + +// xdrv_irremote.ino +#define D_INVALID_JSON "JSON non valido" +#define D_PROTOCOL_NOT_SUPPORTED "Protocollo non supportato" +#define D_IR_PROTOCOL "PROTOCOL" +#define D_IR_BITS "BITS" +#define D_IR_DATA "DATA" +#define D_IRHVAC_VENDOR "VENDOR" +#define D_IRHVAC_POWER "POWER" +#define D_IRHVAC_MODE "MODE" +#define D_IRHVAC_FANSPEED "FANSPEED" +#define D_IRHVAC_TEMP "TEMP" +#define D_IRRECEIVED "IrReceived" + +// xdrv_snfbridge.ino +#define D_RFRECEIVED "RfReceived" +#define D_START_LEARNING "Avvio apprendimento" +#define D_SET_TO_DEFAULT "Imposta al default" +#define D_DEFAULT_SENT "Default inviato" +#define D_LEARNED_SENT "Apprendimento inviato" +#define D_LEARNING_ACTIVE "Apprendimento attivo" +#define D_LEARN_FAILED "Apprendimento fallito" +#define D_LEARNED "Appreso" +#define D_SAVED "Salvato" + +// xdrv_wemohue.ino +#define D_MULTICAST_DISABLED "Multicast disabilitato" +#define D_MULTICAST_REJOINED "Multicast (ri)associato" +#define D_MULTICAST_JOIN_FAILED "Associazione Multicast fallita" +#define D_FAILED_TO_SEND_RESPONSE "Invio risposta fallito" + +#define D_WEMO "WeMo" +#define D_WEMO_BASIC_EVENT "WeMo evento base" +#define D_WEMO_EVENT_SERVICE "WeMo servizio eventi" +#define D_WEMO_SETUP "Impostazione WeMo" +#define D_RESPONSE_SENT "Risposta inviata" + +#define D_HUE "Hue" +#define D_HUE_BRIDGE_SETUP "Impostazione Hue" +#define D_HUE_API_NOT_IMPLEMENTED "Hue API non implementata" +#define D_HUE_API "Hue API" +#define D_HUE_POST_ARGS "Hue POST argomenti" +#define D_3_RESPONSE_PACKETS_SENT "3 pacchetti di risposta inviati" + +// xsns_03_energy.ino +#define D_MAXPOWERREACHED "MaxPowerReached" +#define D_MAXPOWERREACHEDRETRY "MaxPowerReachedRetry" +#define D_POWERMONITOR "PowerMonitor" +#define D_ENERGYMONITOR "EnergyMonitor" +#define D_MAXENERGYREACHED "MaxEnergyReached" +#define D_ENERGY_TODAY "Energia Oggi" +#define D_ENERGY_YESTERDAY "Energia Ieri" +#define D_ENERGY_TOTAL "Energia Totale" + +// xsns_05_ds18b20.ino +#define D_SENSOR_BUSY "Sensore occupato" +#define D_SENSOR_CRC_ERROR "Sensore errore CRC" +#define D_SENSORS_FOUND "Sensori trovati" + +// xsns_06_dht.ino +#define D_TIMEOUT_WAITING_FOR "Attesa timeout per" +#define D_START_SIGNAL_LOW "inizio segnale basso" +#define D_START_SIGNAL_HIGH "inizio segnale alto" +#define D_PULSE "impulso" +#define D_CHECKSUM_FAILURE "Checksum fallito" + +// xsns_07_sht1x.ino +#define D_SENSOR_DID_NOT_ACK_COMMAND "Sensore non ha eseguito il comando ACK" +#define D_SHT1X_FOUND "SHT1X trovato" + +// sonoff_template.h +// Max string length is 8 characters including suffixes +#define D_SENSOR_NONE "None" +#define D_SENSOR_DHT11 "DHT11" +#define D_SENSOR_AM2301 "AM2301" +#define D_SENSOR_SI7021 "SI7021" +#define D_SENSOR_DS18X20 "DS18x20" +#define D_SENSOR_I2C_SCL "I2C SCL" +#define D_SENSOR_I2C_SDA "I2C SDA" +#define D_SENSOR_WS2812 "WS2812" +#define D_SENSOR_IRSEND "IRsend" +#define D_SENSOR_SWITCH "Switch" // Suffix "1" +#define D_SENSOR_BUTTON "Button" // Suffix "1" +#define D_SENSOR_RELAY "Relay" // Suffix "1i" +#define D_SENSOR_LED "Led" // Suffix "1i" +#define D_SENSOR_PWM "PWM" // Suffix "1" +#define D_SENSOR_COUNTER "Counter" // Suffix "1" +#define D_SENSOR_IRRECV "IRrecv" +#define D_SENSOR_MHZ_RX "MHZ Rx" +#define D_SENSOR_MHZ_TX "MHZ Tx" +#define D_SENSOR_PZEM_RX "PZEM Rx" +#define D_SENSOR_PZEM_TX "PZEM Tx" +#define D_SENSOR_SAIR_RX "SAir Rx" +#define D_SENSOR_SAIR_TX "SAir Tx" +#define D_SENSOR_SPI_CS "SPI CS" +#define D_SENSOR_SPI_DC "SPI DC" +#define D_SENSOR_BACKLIGHT "BLight" + +// Units +#define D_UNIT_AMPERE "A" +#define D_UNIT_HOUR "Hr" +#define D_UNIT_KILOOHM "kOhm" +#define D_UNIT_KILOWATTHOUR "kWh" +#define D_UNIT_LUX "lx" +#define D_UNIT_MICROSECOND "us" +#define D_UNIT_MILLIAMPERE "mA" +#define D_UNIT_MILLISECOND "ms" +#define D_UNIT_MINUTE "Min" +#define D_UNIT_PPM "ppm" +#define D_UNIT_PRESSURE "hPa" +#define D_UNIT_SECOND "sec" +#define D_UNIT_SECTORS "settori" +#define D_UNIT_VOLT "V" +#define D_UNIT_WATT "W" +#define D_UNIT_WATTHOUR "Wh" + +// Log message prefix +#define D_LOG_APPLICATION "APP: " // Application +#define D_LOG_BRIDGE "BRG: " // Bridge +#define D_LOG_CONFIG "CFG: " // Settings +#define D_LOG_COMMAND "CMD: " // Command +#define D_LOG_DEBUG "DBG: " // Debug +#define D_LOG_DHT "DHT: " // DHT sensor +#define D_LOG_DOMOTICZ "DOM: " // Domoticz +#define D_LOG_DSB "DSB: " // DS18xB20 sensor +#define D_LOG_HTTP "HTP: " // HTTP webserver +#define D_LOG_I2C "I2C: " // I2C +#define D_LOG_IRR "IRR: " // Infra Red Received +#define D_LOG_LOG "LOG: " // Logging +#define D_LOG_MODULE "MOD: " // Module +#define D_LOG_MDNS "DNS: " // mDNS +#define D_LOG_MQTT "MQT: " // MQTT +#define D_LOG_OTHER "OTH: " // Other +#define D_LOG_RESULT "RSL: " // Result +#define D_LOG_RFR "RFR: " // RF Received +#define D_LOG_SERIAL "SER: " // Serial +#define D_LOG_SHT1 "SHT: " // SHT1x sensor +#define D_LOG_UPLOAD "UPL: " // Upload +#define D_LOG_UPNP "UPP: " // UPnP +#define D_LOG_WIFI "WIF: " // Wifi + +// Result +#define D_RSLT_RESULT "RESULT" +#define D_RSLT_INFO "INFO" +#define D_RSLT_STATE "STATE" +#define D_RSLT_SENSOR "SENSOR" +#define D_RSLT_UPTIME "UPTIME" +#define D_RSLT_MARGINS "MARGINS" +#define D_RSLT_WARNING "WARNING" +#define D_RSLT_ENERGY "ENERGY" + +// Commands +#define D_CMND_MQTTHOST "MqttHost" +#define D_CMND_MQTTPORT "MqttPort" +#define D_CMND_MQTTRETRY "MqttRetry" +#define D_CMND_STATETEXT "StateText" +#define D_CMND_MQTTFINGERPRINT "MqttFingerprint" +#define D_CMND_MQTTCLIENT "MqttClient" +#define D_CMND_MQTTUSER "MqttUser" +#define D_CMND_MQTTPASSWORD "MqttPassword" +#define D_CMND_FULLTOPIC "FullTopic" +#define D_CMND_PREFIX "Prefix" + #define PRFX_MAX_STRING_LENGTH 5 + #define D_CMND "cmnd" + #define D_STAT "stat" + #define D_TELE "tele" +#define D_CMND_GROUPTOPIC "GroupTopic" +#define D_CMND_TOPIC "Topic" +#define D_CMND_BUTTONTOPIC "ButtonTopic" +#define D_CMND_SWITCHTOPIC "SwitchTopic" +#define D_CMND_BUTTONRETAIN "ButtonRetain" +#define D_CMND_SWITCHRETAIN "SwitchRetain" +#define D_CMND_POWERRETAIN "PowerRetain" +#define D_CMND_SENSORRETAIN "SensorRetain" +#define D_CMND_BACKLOG "Backlog" +#define D_CMND_DELAY "Delay" +#define D_CMND_STATUS "Status" + #define D_STATUS1_PARAMETER "PRM" + #define D_STATUS2_FIRMWARE "FWR" + #define D_STATUS3_LOGGING "LOG" + #define D_STATUS4_MEMORY "MEM" + #define D_STATUS5_NETWORK "NET" + #define D_STATUS6_MQTT "MQT" + #define D_STATUS7_TIME "TIM" + #define D_STATUS8_POWER "PWR" + #define D_STATUS9_MARGIN "PTH" + #define D_STATUS10_SENSOR "SNS" + #define D_STATUS11_STATUS "STS" +#define D_CMND_POWER "Power" + #define D_RSLT_POWER "POWER" +#define D_CMND_POWERONSTATE "PowerOnState" +#define D_CMND_PULSETIME "PulseTime" +#define D_CMND_BLINKTIME "BlinkTime" +#define D_CMND_BLINKCOUNT "BlinkCount" +#define D_CMND_SAVEDATA "SaveData" +#define D_CMND_SETOPTION "SetOption" +#define D_CMND_TEMPERATURE_RESOLUTION "TempRes" +#define D_CMND_HUMIDITY_RESOLUTION "HumRes" +#define D_CMND_PRESSURE_RESOLUTION "PressRes" +#define D_CMND_POWER_RESOLUTION "WattRes" +#define D_CMND_VOLTAGE_RESOLUTION "VoltRes" +#define D_CMND_CURRENT_RESOLUTION "AmpRes" +#define D_CMND_ENERGY_RESOLUTION "EnergyRes" +#define D_CMND_MODULE "Module" +#define D_CMND_MODULES "Modules" +#define D_CMND_GPIO "GPIO" + #define D_NOT_SUPPORTED "Not supported" +#define D_CMND_GPIOS "GPIOs" +#define D_CMND_PWM "PWM" +#define D_CMND_PWMFREQUENCY "PWMFrequency" +#define D_CMND_PWMRANGE "PWMRange" +#define D_CMND_COUNTER "Counter" +#define D_CMND_COUNTERTYPE "CounterType" +#define D_CMND_COUNTERDEBOUNCE "CounterDebounce" +#define D_CMND_SLEEP "Sleep" +#define D_CMND_UPLOAD "Upload" +#define D_CMND_UPGRADE "Upgrade" + #define D_ONE_OR_GT "1 or >%s to upgrade" +#define D_CMND_OTAURL "OtaUrl" +#define D_CMND_SERIALLOG "SerialLog" +#define D_CMND_SYSLOG "SysLog" +#define D_CMND_LOGHOST "LogHost" +#define D_CMND_LOGPORT "LogPort" +#define D_CMND_IPADDRESS "IPAddress" +#define D_CMND_NTPSERVER "NtpServer" +#define D_CMND_AP "Ap" +#define D_CMND_SSID "SSId" +#define D_CMND_PASSWORD "Password" +#define D_CMND_HOSTNAME "Hostname" +#define D_CMND_WIFICONFIG "WifiConfig" + #define WCFG_MAX_STRING_LENGTH 12 + #define D_WCFG_0_RESTART "Restart" + #define D_WCFG_1_SMARTCONFIG "SmartConfig" + #define D_WCFG_2_WIFIMANAGER "WifiManager" + #define D_WCFG_3_WPSCONFIG "WPSConfig" + #define D_WCFG_4_RETRY "Retry" + #define D_WCFG_5_WAIT "Wait" +#define D_CMND_FRIENDLYNAME "FriendlyName" +#define D_CMND_SWITCHMODE "SwitchMode" +#define D_CMND_WEBSERVER "Webserver" + #define D_WEBSERVER_MODE "WebServerMode" + #define D_ACTIVE_FOR "Active for" + #define D_ON_DEVICE "on" +#define D_CMND_WEBPASSWORD "WebPassword" +#define D_CMND_WEBLOG "WebLog" +#define D_CMND_EMULATION "Emulation" +#define D_CMND_TELEPERIOD "TelePeriod" +#define D_CMND_RESTART "Restart" + #define D_ONE_TO_RESTART "1 to restart" +#define D_CMND_RESET "Reset" + #define D_RESET_AND_RESTARTING "Reset and Restarting" + #define D_ONE_TO_RESET "1 to reset" +#define D_CMND_TIMEZONE "Timezone" +#define D_CMND_ALTITUDE "Altitude" +#define D_CMND_LEDPOWER "LedPower" +#define D_CMND_LEDSTATE "LedState" +#define D_CMND_CFGDUMP "CfgDump" +#define D_CMND_I2CSCAN "I2CScan" +#define D_CMND_INA219MODE "Ina219Mode" +#define D_CMND_EXCEPTION "Exception" + +// Commands xdrv_domoticz.ino +#define D_CMND_DOMOTICZ "Domoticz" +#define D_CMND_IDX "Idx" +#define D_CMND_KEYIDX "KeyIdx" +#define D_CMND_SWITCHIDX "SwitchIdx" +#define D_CMND_SENSORIDX "SensorIdx" +#define D_CMND_UPDATETIMER "UpdateTimer" + +// Commands xdrv_irremote.ino +#define D_CMND_IRSEND "IRSend" +#define D_CMND_IRHVAC "IRHVAC" + +// Commands xdrv_light.ino +#define D_CMND_COLOR "Color" +#define D_CMND_COLORTEMPERATURE "CT" +#define D_CMND_DIMMER "Dimmer" +#define D_CMND_LED "Led" +#define D_CMND_LEDTABLE "LedTable" +#define D_CMND_FADE "Fade" +#define D_CMND_PIXELS "Pixels" +#define D_CMND_SCHEME "Scheme" +#define D_CMND_SPEED "Speed" +#define D_CMND_WAKEUP "Wakeup" +#define D_CMND_WAKEUPDURATION "WakeUpDuration" +#define D_CMND_WIDTH "Width" + +// Commands xdrv_snfbridge.ino +#define D_CMND_RFCODE "RfCode" +#define D_CMND_RFHIGH "RfHigh" +#define D_CMND_RFHOST "RfHost" +#define D_CMND_RFKEY "RfKey" +#define D_CMND_RFLOW "RfLow" +#define D_CMND_RFSYNC "RfSync" + +// Commands xsns_03_energy.ino +#define D_CMND_POWERLOW "PowerLow" +#define D_CMND_POWERHIGH "PowerHigh" +#define D_CMND_VOLTAGELOW "VoltageLow" +#define D_CMND_VOLTAGEHIGH "VoltageHigh" +#define D_CMND_CURRENTLOW "CurrentLow" +#define D_CMND_CURRENTHIGH "CurrentHigh" +#define D_CMND_ENERGYRESET "EnergyReset" +#define D_CMND_HLWPCAL "HlwPcal" +#define D_CMND_HLWPSET "HlwPset" +#define D_CMND_HLWUCAL "HlwUcal" +#define D_CMND_HLWUSET "HlwUset" +#define D_CMND_HLWICAL "HlwIcal" +#define D_CMND_HLWISET "HlwIset" +#define D_CMND_MAXPOWER "MaxPower" +#define D_CMND_MAXPOWERHOLD "MaxPowerHold" +#define D_CMND_MAXPOWERWINDOW "MaxPowerWindow" +#define D_CMND_SAFEPOWER "SafePower" +#define D_CMND_SAFEPOWERHOLD "SafePowerHold" +#define D_CMND_SAFEPOWERWINDOW "SafePowerWindow" +#define D_CMND_MAXENERGY "MaxEnergy" +#define D_CMND_MAXENERGYSTART "MaxEnergyStart" + +#endif // _LANGUAGE_EN_GB_H_ \ No newline at end of file diff --git a/sonoff/settings.ino b/sonoff/settings.ino index c6ed275db..92d3b926d 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -18,7 +18,11 @@ */ #ifndef DOMOTICZ_UPDATE_TIMER -#define DOMOTICZ_UPDATE_TIMER 0 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds) (Optional) +#define DOMOTICZ_UPDATE_TIMER 0 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds) (Optional) +#endif + +#ifndef EMULATION +#define EMULATION EMUL_NONE // [Emulation] Select Belkin WeMo (single relay/light) or Hue Bridge emulation (multi relay/light) (EMUL_NONE, EMUL_WEMO or EMUL_HUE) #endif /*********************************************************************************************\ diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 770aab982..23afff59e 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,8 +25,8 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x050A0004 -#define VERSION_STRING "5.10.0d" // Would be great to have a macro that fills this from VERSION ... +#define VERSION 0x050A0005 +#define VERSION_STRING "5.10.0e" // Would be great to have a macro that fills this from VERSION ... // Location specific includes #include "sonoff.h" // Enumaration used in user_config.h diff --git a/sonoff/user_config.h b/sonoff/user_config.h index 263bbdce6..d7325d5db 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -33,6 +33,7 @@ //#define MY_LANGUAGE nl-NL // Dutch in the Netherlands //#define MY_LANGUAGE de-DE // German in Germany //#define MY_LANGUAGE pl-PL // Polish in Poland +//#define MY_LANGUAGE it-IT // Italian in Italy // -- Project ------------------------------------- #define PROJECT "sonoff" // PROJECT is used as the default topic delimiter and OTA file name @@ -122,7 +123,7 @@ #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 USE_EMULATION // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+16k code, +2k mem) #define EMULATION EMUL_NONE // [Emulation] Select Belkin WeMo (single relay/light) or Hue Bridge emulation (multi relay/light) (EMUL_NONE, EMUL_WEMO or EMUL_HUE) // -- mDNS ---------------------------------------- diff --git a/sonoff/xdrv_wemohue.ino b/sonoff/xdrv_wemohue.ino index e441cf513..2bd7c3100 100755 --- a/sonoff/xdrv_wemohue.ino +++ b/sonoff/xdrv_wemohue.ino @@ -241,6 +241,38 @@ void PollUdp() \*********************************************************************************************/ const char WEMO_EVENTSERVICE_XML[] PROGMEM = +/* + // Original + "" + "" + "" + "SetBinaryState" + "" + "" + "" + "BinaryState" + "BinaryState" + "in" + "" + "" + "" + "" + "BinaryState" + "Boolean" + "0" + "" + "" + "level" + "string" + "0" + "" + "" + "" + "\r\n" + "\r\n"; +*/ + +/* // XosePerez version 20171108 - v2.3.0 "" "" @@ -277,19 +309,63 @@ const char WEMO_EVENTSERVICE_XML[] PROGMEM = "" "" ""; +*/ + + // Reloxx13 from #1357 + "" + "" + "" + "SetBinaryState" + "" + "" + "" + "BinaryState" + "BinaryState" + "in" + "" + "" + "" + "" + "BinaryState" + "Boolean" + "0" + "" + "" + "level" + "string" + "0" + "" + "" + "" + "" + "GetBinaryState" + "" + "" + "" + "BinaryState" + "BinaryState" + "out" + "" + "" + "" + "" + "\r\n" + "\r\n"; const char WEMO_RESPONSE_STATE_SOAP[] PROGMEM = - "" + // Reloxx13 from #1357 + "" "" - "" + "" "{x1" - "" + "" "" - ""; + "\r\n" + "\r\n"; const char WEMO_SETUP_XML[] PROGMEM = "" - "" + "" "" "urn:Belkin:device:controllee:1" "{x1" @@ -316,6 +392,7 @@ const char WEMO_SETUP_XML[] PROGMEM = void HandleUpnpEvent() { AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_BASIC_EVENT)); + String request = WebServer->arg(0); String state_xml = FPSTR(WEMO_RESPONSE_STATE_SOAP); //differentiate get and set state @@ -328,7 +405,7 @@ void HandleUpnpEvent() } } else if(request.indexOf(F("GetBinaryState")) > 0){ - state_xml.replace(F("SetBinaryState"), F("GetBinaryStateResponse")); + state_xml.replace(F("Set"), F("Get")); } state_xml.replace("{x1", String(bitRead(power, devices_present -1))); WebServer->send(200, FPSTR(HDR_CTYPE_XML), state_xml); @@ -337,6 +414,7 @@ void HandleUpnpEvent() void HandleUpnpService() { AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_EVENT_SERVICE)); + WebServer->send(200, FPSTR(HDR_CTYPE_PLAIN), FPSTR(WEMO_EVENTSERVICE_XML)); } From 1e336f5e208d02f094e9aca1756fbbe20a824cc5 Mon Sep 17 00:00:00 2001 From: arendst Date: Thu, 28 Dec 2017 17:08:32 +0100 Subject: [PATCH 3/3] Add support for sensor SHT3x (#1314) * Add support for sensor SHT3x (#1314) --- sonoff/_releasenotes.ino | 1 + sonoff/user_config.h | 4 +- sonoff/xsns_14_sht3x.ino | 44 ++++------ sonoff/xsns_14_sht3x_v2.ino | 142 -------------------------------- sonoff/xsns_14_sht3x_v3.ino | 156 ------------------------------------ 5 files changed, 17 insertions(+), 330 deletions(-) delete mode 100644 sonoff/xsns_14_sht3x_v2.ino delete mode 100644 sonoff/xsns_14_sht3x_v3.ino diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 5a7640f9e..9ec2c7e84 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,6 +1,7 @@ /* 5.10.0e * Add Italian language file (#1449) * Fix Wemo Emulation once again closest to issue (#1357) + * Add support for sensor SHT3x * * 5.10.0d * Renamed commands Color2,3,4 to Color3,4,5 diff --git a/sonoff/user_config.h b/sonoff/user_config.h index d7325d5db..78016fd9e 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -173,9 +173,7 @@ // -- I2C sensors --------------------------------- #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 based on Adafruit (+0k7 code) -// #define USE_SHT3X_V2 // Add I2C code for SHT3x sensor based on EspEasy (+0k7 code) -// #define USE_SHT3X_V3 // Add I2C code for SHT3x sensor based on Wemos (+0k7 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) diff --git a/sonoff/xsns_14_sht3x.ino b/sonoff/xsns_14_sht3x.ino index 39b24d8b4..60d35c787 100644 --- a/sonoff/xsns_14_sht3x.ino +++ b/sonoff/xsns_14_sht3x.ino @@ -22,26 +22,16 @@ /*********************************************************************************************\ * SHT3X - Temperature and Humidy * - * Required library: none but based on Adafruit Industries SHT31 library - * * I2C Address: 0x44 or 0x45 \*********************************************************************************************/ -#define SHT3X_ADDR_GND 0x44 // address pin low (GND) -#define SHT3X_ADDR_VDD 0x45 // address pin high (VDD) +#define SHT3X_ADDR_GND 0x44 // address pin low (GND) +#define SHT3X_ADDR_VDD 0x45 // address pin high (VDD) uint8_t sht3x_type = 0; uint8_t sht3x_address; uint8_t sht3x_addresses[] = { SHT3X_ADDR_GND, SHT3X_ADDR_VDD }; -bool Sht3xConvert() -{ - if (sht3x_type) { - return I2cWrite8(sht3x_address, 0x2C, 0x06); - } - return false; -} - bool Sht3xRead(float &t, float &h) { unsigned int data[6]; @@ -49,22 +39,20 @@ bool Sht3xRead(float &t, float &h) t = NAN; h = NAN; - Wire.requestFrom(sht3x_address, (uint8_t)6); - if (Wire.available() != 6) { + Wire.beginTransmission(sht3x_address); + Wire.write(0x2C); // Enable clock stretching + Wire.write(0x06); // High repeatability + if (Wire.endTransmission() != 0) { // Stop I2C transmission return false; } - // Read 6 bytes of data - // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc - for (uint8_t i = 0; i < 6; i++) { - data[i] = Wire.read(); - } -// delay(50); -// if (Wire.available() != 0) { -// return false; -// } + delay(30); // Timing verified with logic analyzer (10 is to short) + Wire.requestFrom(sht3x_address, (uint8_t)6); // Request 6 bytes of data + for (int i = 0; i < 6; i++) { + data[i] = Wire.read(); // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc + }; t = ConvertTemp((float)((((data[0] << 8) | data[1]) * 175) / 65535.0) - 45); h = (float)((((data[3] << 8) | data[4]) * 100) / 65535.0); - return true; + return (!isnan(t) && !isnan(h)); } /********************************************************************************************/ @@ -75,10 +63,12 @@ void Sht3xDetect() return; } + float t; + float h; sht3x_type = 1; for (byte i = 0; i < sizeof(sht3x_addresses); i++) { sht3x_address = sht3x_addresses[i]; - if (Sht3xConvert()) { + if (Sht3xRead(t, h)) { snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "SHT3X", sht3x_address); AddLog(LOG_LEVEL_DEBUG); return; @@ -128,16 +118,12 @@ boolean Xsns14(byte function) case FUNC_INIT: Sht3xDetect(); break; - case FUNC_PREP_BEFORE_TELEPERIOD: - Sht3xConvert(); - break; case FUNC_JSON_APPEND: Sht3xShow(1); break; #ifdef USE_WEBSERVER case FUNC_WEB_APPEND: Sht3xShow(0); - Sht3xConvert(); break; #endif // USE_WEBSERVER } diff --git a/sonoff/xsns_14_sht3x_v2.ino b/sonoff/xsns_14_sht3x_v2.ino deleted file mode 100644 index 85de8512a..000000000 --- a/sonoff/xsns_14_sht3x_v2.ino +++ /dev/null @@ -1,142 +0,0 @@ -/* - xsns_14_sht3x.ino - SHT3X temperature and humidity sensor support for Sonoff-Tasmota - - Copyright (C) 2018 Theo Arends - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifdef USE_I2C -#ifdef USE_SHT3X_V2 -/*********************************************************************************************\ - * SHT3X - Temperature and Humidy - * - * Required library: none but based on EspEasy plugin 68 - * - * I2C Address: 0x44 or 0x45 -\*********************************************************************************************/ - -#define SHT3X_ADDR_GND 0x44 // address pin low (GND) -#define SHT3X_ADDR_VDD 0x45 // address pin high (VDD) - -uint8_t sht3x_type = 0; -uint8_t sht3x_address; -uint8_t sht3x_addresses[] = { SHT3X_ADDR_GND, SHT3X_ADDR_VDD }; - -bool Sht3xInit() -{ - if (sht3x_type) { - return I2cWrite8(sht3x_address, 0x20, 0x32); // Periodic 0.5mps and repeatability high - } - return false; -} - -bool Sht3xRead(float &t, float &h) -{ - unsigned int data[6]; - - t = NAN; - h = NAN; - - I2cWrite8(sht3x_address, 0xE0, 0x00); // Fetch data - Wire.requestFrom(sht3x_address, (uint8_t)6); - if (Wire.available() != 6) { - return false; - } - // Read 6 bytes of data - // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc - for (uint8_t i = 0; i < 6; i++) { - data[i] = Wire.read(); - } - t = ConvertTemp((float)((((data[0] << 8) | data[1]) * 175) / 65535.0) - 45); - h = (float)((((data[3] << 8) | data[4]) * 100) / 65535.0); - return true; -} - -/********************************************************************************************/ - -void Sht3xDetect() -{ - if (sht3x_type) { - return; - } - - sht3x_type = 1; - for (byte i = 0; i < sizeof(sht3x_addresses); i++) { - sht3x_address = sht3x_addresses[i]; - if (Sht3xInit()) { - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "SHT3X", sht3x_address); - AddLog(LOG_LEVEL_DEBUG); - return; - } - } - sht3x_type = 0; -} - -void Sht3xShow(boolean json) -{ - if (sht3x_type) { - float t; - float h; - if (Sht3xRead(t, h)) { - char temperature[10]; - char humidity[10]; - dtostrfd(t, Settings.flag2.temperature_resolution, temperature); - dtostrfd(h, Settings.flag2.humidity_resolution, humidity); - - if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, "SHT3X", temperature, humidity); -#ifdef USE_DOMOTICZ - DomoticzTempHumSensor(temperature, humidity); -#endif // USE_DOMOTICZ -#ifdef USE_WEBSERVER - } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, "SHT3X", temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, "SHT3X", humidity); -#endif // USE_WEBSERVER - } - } - } -} - -/*********************************************************************************************\ - * Interface -\*********************************************************************************************/ - -#define XSNS_14 - -boolean Xsns14(byte function) -{ - boolean result = false; - - if (i2c_flg) { - switch (function) { - case FUNC_INIT: - Sht3xDetect(); - break; - case FUNC_JSON_APPEND: - Sht3xShow(1); - break; -#ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: - Sht3xShow(0); - break; -#endif // USE_WEBSERVER - } - } - return result; -} - -#endif // USE_SHT3X_V2 -#endif // USE_I2C \ No newline at end of file diff --git a/sonoff/xsns_14_sht3x_v3.ino b/sonoff/xsns_14_sht3x_v3.ino deleted file mode 100644 index aff368c1a..000000000 --- a/sonoff/xsns_14_sht3x_v3.ino +++ /dev/null @@ -1,156 +0,0 @@ -/* - xsns_14_sht3x.ino - SHT3X temperature and humidity sensor support for Sonoff-Tasmota - - Copyright (C) 2018 Theo Arends - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifdef USE_I2C -#ifdef USE_SHT3X_V3 -/*********************************************************************************************\ - * SHT3X - Temperature and Humidy - * - * Required library: none but based on Wemos library - * - * I2C Address: 0x44 or 0x45 -\*********************************************************************************************/ - -#define SHT3X_ADDR_GND 0x44 // address pin low (GND) -#define SHT3X_ADDR_VDD 0x45 // address pin high (VDD) - -uint8_t sht3x_type = 0; -uint8_t sht3x_address; -uint8_t sht3x_addresses[] = { SHT3X_ADDR_GND, SHT3X_ADDR_VDD }; - -bool Sht3xConvert() -{ - if (sht3x_type) { - // Start I2C Transmission - Wire.beginTransmission(sht3x_address); - // Send measurement command - Wire.write(0x2C); - Wire.write(0x06); - // Stop I2C transmission - if (Wire.endTransmission() != 0) { - return false; - } - } - return true; -} - -bool Sht3xRead(float &t, float &h) -{ - unsigned int data[6]; - - t = NAN; - h = NAN; - - // Request 6 bytes of data - Wire.requestFrom(sht3x_address, (uint8_t)6); - // Read 6 bytes of data - // cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc - for (int i = 0; i < 6; i++) { - data[i] = Wire.read(); - }; - delay(50); - if (Wire.available() != 0) { - return false; - } - // Convert the data - t = ConvertTemp((float)((((data[0] << 8) | data[1]) * 175) / 65535.0) - 45); - h = (float)((((data[3] << 8) | data[4]) * 100) / 65535.0); - return true; -} - -/********************************************************************************************/ - -void Sht3xDetect() -{ - if (sht3x_type) { - return; - } - - sht3x_type = 1; - for (byte i = 0; i < sizeof(sht3x_addresses); i++) { - sht3x_address = sht3x_addresses[i]; - if (Sht3xConvert()) { - snprintf_P(log_data, sizeof(log_data), S_LOG_I2C_FOUND_AT, "SHT3X", sht3x_address); - AddLog(LOG_LEVEL_DEBUG); - return; - } - } - sht3x_type = 0; -} - -void Sht3xShow(boolean json) -{ - if (sht3x_type) { - float t; - float h; - if (Sht3xRead(t, h)) { - char temperature[10]; - char humidity[10]; - dtostrfd(t, Settings.flag2.temperature_resolution, temperature); - dtostrfd(h, Settings.flag2.humidity_resolution, humidity); - - if (json) { - snprintf_P(mqtt_data, sizeof(mqtt_data), JSON_SNS_TEMPHUM, mqtt_data, "SHT3X", temperature, humidity); -#ifdef USE_DOMOTICZ - DomoticzTempHumSensor(temperature, humidity); -#endif // USE_DOMOTICZ -#ifdef USE_WEBSERVER - } else { - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, "SHT3X", temperature, TempUnit()); - snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_HUM, mqtt_data, "SHT3X", humidity); -#endif // USE_WEBSERVER - } - } - } -} - -/*********************************************************************************************\ - * Interface -\*********************************************************************************************/ - -#define XSNS_14 - -boolean Xsns14(byte function) -{ - boolean result = false; - - if (i2c_flg) { - switch (function) { - case FUNC_INIT: - Sht3xDetect(); - break; - case FUNC_PREP_BEFORE_TELEPERIOD: - Sht3xConvert(); - break; - case FUNC_JSON_APPEND: - Sht3xShow(1); - break; -#ifdef USE_WEBSERVER - case FUNC_WEB_APPEND: - Sht3xShow(0); - Sht3xConvert(); - break; -#endif // USE_WEBSERVER - } - } - return result; -} - -#endif // USE_SHT3X_V3 -#endif // USE_I2C \ No newline at end of file