Skip to content

Commit

Permalink
v5.10.0d
Browse files Browse the repository at this point in the history
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 (arendst#1357)
 * Updated German translation (arendst#1438)
  • Loading branch information
arendst committed Dec 27, 2017
1 parent b641cd7 commit 6c903d4
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 77 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
9 changes: 8 additions & 1 deletion sonoff/_releasenotes.ino
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
44 changes: 22 additions & 22 deletions sonoff/language/de-DE.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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]"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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=<Benutzername>&password=<Passwort>"

// xdrv_domoticz.ino
Expand Down
4 changes: 2 additions & 2 deletions sonoff/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions sonoff/sonoff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions sonoff/user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)

/*********************************************************************************************\
Expand Down
55 changes: 46 additions & 9 deletions sonoff/xdrv_light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 6c903d4

Please sign in to comment.