Skip to content

Commit

Permalink
Merge pull request #1 from arendst/development
Browse files Browse the repository at this point in the history
Updated to v6.1.0a
  • Loading branch information
matias-b authored Jul 6, 2018
2 parents d08cefb + 2058b9f commit 82f3723
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 314 deletions.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
### Development
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)

Current version is **6.0.0c** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
Current version is **6.1.0a** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.

### Disclaimer
:warning: **DANGER OF ELECTROCUTION** :warning:
Expand All @@ -39,7 +39,7 @@ If you want to compile Sonoff-Tasmota yourself keep in mind the following:
- Once uploaded select module using the configuration webpage or the commands ```Modules``` and ```Module```.
- After reboot select config menu again or use commands ```GPIOs``` and ```GPIO``` to change GPIO with desired sensor.

### Migration Instructions
### Migration Information
See [wiki migration path](https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade#migration-path) for instructions how to migrate to a major version. Pay attention to the following version breaks due to dynamic settings updates:

1. Migrate to **Sonoff-Tasmota 3.9.x**
Expand Down Expand Up @@ -134,34 +134,34 @@ Different firmware images are released based on Features and Sensors selection g
| USE_ADS1115 | - | - | - | - | x |
| USE_ADS1115_I2CDEV | - | - | - | - | - |
| USE_INA219 | - | - | - | - | x |
| USE_APDS9960 | - | - | - | - | - |
| USE_MGS | - | - | - | - | x |
| USE_SPI | - | - | - | - | - |
| USE_MHZ19 | x | x | - | x | x |
| USE_SENSEAIR | x | x | - | x | x |
| USE_PMS5003 | x | x | - | x | x |
| USE_SENSEAIR | x | - | - | x | x |
| USE_PMS5003 | x | - | - | x | x |
| USE_NOVA_SDS | x | - | - | x | x |
| USE_PZEM004T | x | x | - | x | x |
| USE_PZEM004T | x | - | - | x | x |
| USE_SERIAL_BRIDGE | x | - | - | x | x |
| USE_SDM120 | x | - | - | - | x |
| USE_SDM630 | x | - | - | - | x |
| USE_SDM120 | - | - | - | - | x |
| USE_SDM630 | - | - | - | - | x |
| USE_IR_REMOTE | x | x | - | x | x |
| USE_IR_HVAC | - | - | - | - | x |
| USE_IR_RECEIVE | x | - | - | x | x |
| USE_WS2812 | x | x | - | x | x |
| USE_WS2812_DMA | - | - | - | - | - |
| USE_ARILUX_RF | x | x | - | x | x |
| USE_ARILUX_RF | x | - | - | x | x |
| USE_SR04 | x | - | - | x | x |
| USE_TM1638 | - | - | - | - | - |
| USE_RF_FLASH | x | - | - | x | x |

#### Typical File Size
#### Typical file size

| ESP/Arduino library version | sonoff | classic | minimal | knx | allsensors |
|-----------------------------|--------|---------|---------|------|------------|
| ESP/Arduino lib v2.3.0 | 529k | 490k | 429k | 538k | 554k |
| ESP/Arduino lib v2.4.0 | 534k | 498k | 436k | 542k | 558k |
| ESP/Arduino lib v2.4.1 | 536k | 501k | 439k | 545k | 560k |
| ESP/Arduino lib v2.3.0 | 538k | 490k | 399k | 548k | 562k |
| ESP/Arduino lib v2.4.0 | 543k | 498k | 406k | 553k | 565k |
| ESP/Arduino lib v2.4.1 | 544k | 500k | 408k | 555k | 567k |

See [Tasmota ESP/Arduino library version related issues](https://github.com/arendst/Sonoff-Tasmota/wiki/Theo's-Tasmota-Tips#20180523---relation-tasmota-and-esp8266arduino-core-version) for more information.

### Contribute
You can contribute to Sonoff-Tasmota by
Expand All @@ -176,13 +176,14 @@ You can contribute to Sonoff-Tasmota by
#### Libraries Used
Libraries used with Sonoff-Tasmota are:
- [ESP8266 core for Arduino](https://github.com/esp8266/Arduino)
- [Adafruit BME680](https://github.com/adafruit/Adafruit_BME680)
- [Adafruit Sensor](https://github.com/adafruit/Adafruit_Sensor)
- [Adafruit SGP30](https://github.com/adafruit/Adafruit_SGP30)
- [ArduinoJson](https://arduinojson.org/)
- [Bosch BME680](https://github.com/BoschSensortec/BME680_driver)
- [C2 Programmer](http://app.cear.ufpb.br/~lucas.hartmann/tag/efm8bb1/)
- [Esp8266MqttClient](https://github.com/tuanpmt/ESP8266MQTTClient)
- [esp-knx-ip](https://github.com/envy/esp-knx-ip)
- [esp-mqtt-arduino](https://github.com/i-n-g-o/esp-mqtt-arduino)
- [ESPAsyncUDP](https://github.com/me-no-dev/ESPAsyncUDP)
- [I2Cdevlib](https://github.com/jrowberg/i2cdevlib)
- [IRremoteEsp8266](https://github.com/markszabo/IRremoteESP8266)
- [JobaTsl2561](https://github.com/joba-1/Joba_Tsl2561)
Expand Down
5 changes: 2 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ platform = espressif8266@1.5.0
; *** Esp8266 core for Arduino version 2.4.0
;platform = espressif8266@1.6.0
; *** Esp8266 core for Arduino version 2.4.1
;platform = espressif8266@1.7.0
;platform = espressif8266@1.7.3
; *** Esp8266 core for Arduino version latest beta
;platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
; *** Esp8266 core for Arduino current version
Expand All @@ -62,8 +62,7 @@ build_flags =
monitor_speed = 115200

; *** Upload Serial reset method for Wemos and NodeMCU
;upload_speed = 115200
upload_speed = 512000
upload_speed = 115200
upload_resetmethod = nodemcu
upload_port = COM5
; *** Fix Esp/Arduino core 2.4.x induced Tasmota unused floating point includes
Expand Down
49 changes: 24 additions & 25 deletions sonoff/_releasenotes.ino
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
/* 6.0.0c
* Rewrite BME680 driver now using latest Bosch BME680 library (#2969)
* Add support for bitflags SetOption50 .. SetOption81 (#3118)
*
* 6.0.0b
* Add support for BlitzWolf BW-SHP2 (and Homecube, Gosund SP1) Energy Monitoring Smart Socket (#2223)
* Add support for Sonoff iFan02 as module 44 introducing command FanSpeed 0..3 (#2839)
* Add support for Sonoff S26 Smart Socket (#2808)
* Add command SetOption30 to enforce Hass discovery as light group (#1784)
* Add decimal values support for commands ADD, SUB, MULT and SCALE (#3083, #3089)
/* 6.1.0a
* Add experimental (untested) TM1638 switch support (#2226)
* Change number of switches from 4 to 8 (#2885, #3086)
*
* 6.0.0a
* Add support for APDS9960 proximity sensor (#3051)
* Add increment and decrement value to command Counter (#2838)
* Add option 0 to command Timers disarming all timers (#2962)
* Add time in minutes to rule Time#Initialized, Time#set and Time#Minute (#2669)
* Add rule variables %time% for minutes since midnight, %uptime%, %sunrise% and %sunset% giving time in minutes (#2669)
* Add heap and stack debug information
* Add command SetOption28 to switch between hex or decimal Sonoff Bridge RF received data format (#3008)
* Add command SetOption29 to switch between hex or decimal IR received data format
* Add performance improvement when updating multiple individual WS2812 pixels (#3007)
* Add debug facilities using optional xdrv_99_debug.ino to enable in user_config.h
* Add KNX support for DS18S20 Temperature sensor
* Add CRC to Settings making future upgrades more fail-safe
* Add support for uploading Sonoff Bridge firmware found in tools/fw_efm8bb1 folder build by Portisch using Web Gui File Upload (#2886)
* Add support for I2C temperature sensor LM75AD (#2909)
* Add command RfRaw to control Portisch firmware features
*
* 6.1.0 20180706
* Remove version 3, 4 and pre 5.2 settings auto-upgrade. See https://github.com/arendst/Sonoff-Tasmota/wiki/Upgrade#migration-path
* Change default CFG_HOLDER from 0x20161209 to 4617 (=0x1209) - no impact on default upgrades
* Change number of supported switches from 4 to 8 (#2885, #3086)
* Change BME680 driver from Adafruit to Bosch BME680 library (#2969)
* Fix Pzem004T checksum error
* Fix KNX bug when doing reply of sensors values
* Fix rules induced LWT message
* Fix possible wifi connection problem (#1366)
* Add Ukrainian language file
* Add KNX support for DS18S20 Temperature sensor
* Add CRC to Settings making future upgrades more fail-safe
* Add command SetOption30 to enforce Hass discovery as light group (#1784)
* Add support for BlitzWolf BW-SHP2 (and Homecube, Gosund SP1) Energy Monitoring Smart Socket (#2223)
* Add time in minutes to rule Time#Initialized, Time#set and Time#Minute (#2669)
* Add rule variables %time% for minutes since midnight, %uptime%, %sunrise% and %sunset% giving time in minutes (#2669)
* Add support for Sonoff S26 Smart Socket (#2808)
* Add increment and decrement value to command Counter (#2838)
* Add support for Sonoff iFan02 as module 44 introducing command FanSpeed 0..3 (#2839)
* Add support for uploading Sonoff Bridge firmware found in tools/fw_efm8bb1 folder build by Portisch using Web Gui File Upload (#2886)
* Add command RfRaw to control Portisch firmware features
* Add support for I2C temperature sensor LM75AD (#2909)
* Add option 0 to command Timers disarming all timers (#2962)
* Add performance improvement when updating multiple individual WS2812 pixels (#3007)
* Add command SetOption28 to switch between hex or decimal Sonoff Bridge RF received data format (#3008)
* Add command SetOption29 to switch between hex or decimal IR received data format
* Add decimal values support for commands ADD, SUB, MULT and SCALE (#3083, #3089)
* Add support for bitflags SetOption50 .. SetOption81 (#3118)
*
* 5.14.0b
* Add Console Commands to send KNX Commands
Expand Down
110 changes: 61 additions & 49 deletions sonoff/sonoff.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/

#define VERSION 0x06000003 // 6.0.0c
#define VERSION 0x06010001 // 6.1.0a

// Location specific includes
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
Expand Down Expand Up @@ -75,6 +75,12 @@
// Structs
#include "settings.h"

#ifdef BE_MINIMAL
enum TasmotaCommands {
CMND_POWER, CMND_FANSPEED, CMND_STATUS, CMND_STATE, CMND_SLEEP, CMND_UPGRADE, CMND_UPLOAD, CMND_OTAURL, CMND_SERIALLOG, CMND_RESTART };
const char kTasmotaCommands[] PROGMEM =
D_CMND_POWER "|" D_CMND_FANSPEED "|" D_CMND_STATUS "|" D_CMND_STATE "|" D_CMND_SLEEP "|" D_CMND_UPGRADE "|" D_CMND_UPLOAD "|" D_CMND_OTAURL "|" D_CMND_SERIALLOG "|" D_CMND_RESTART;
#else
enum TasmotaCommands {
CMND_BACKLOG, CMND_DELAY, CMND_POWER, CMND_FANSPEED, CMND_STATUS, CMND_STATE, CMND_POWERONSTATE, CMND_PULSETIME,
CMND_BLINKTIME, CMND_BLINKCOUNT, CMND_SENSOR, CMND_SAVEDATA, CMND_SETOPTION, CMND_TEMPERATURE_RESOLUTION, CMND_HUMIDITY_RESOLUTION,
Expand All @@ -95,6 +101,7 @@ const char kTasmotaCommands[] PROGMEM =
D_CMND_WIFICONFIG "|" D_CMND_FRIENDLYNAME "|" D_CMND_SWITCHMODE "|"
D_CMND_TELEPERIOD "|" D_CMND_RESTART "|" D_CMND_RESET "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|"
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER;
#endif

const uint8_t kIFan02Speed[4][3] = {{6,6,6}, {7,6,6}, {7,7,6}, {7,6,7}};

Expand Down Expand Up @@ -480,6 +487,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
type = NULL; // Unknown command
}
}
#ifndef BE_MINIMAL
else if (CMND_BACKLOG == command_code) {
if (data_len) {
uint8_t bl_pointer = (!backlog_pointer) ? MAX_BACKLOG -1 : backlog_pointer;
Expand Down Expand Up @@ -513,6 +521,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
if ((payload >= MIN_BACKLOG_DELAY) && (payload <= 3600)) backlog_delay = payload;
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, backlog_delay);
}
#endif // Not BE_MINIMAL
else if ((CMND_POWER == command_code) && (index > 0) && (index <= devices_present)) {
if ((payload < 0) || (payload > 4)) payload = 9;
// Settings.flag.device_index_enable = user_append_index;
Expand Down Expand Up @@ -540,6 +549,54 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
mqtt_data[0] = '\0';
MqttShowState();
}
else if (CMND_SLEEP == command_code) {
if ((payload >= 0) && (payload < 251)) {
if ((!Settings.sleep && payload) || (Settings.sleep && !payload)) restart_flag = 2;
Settings.sleep = payload;
sleep = payload;
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_UNIT_NVALUE_UNIT, command, sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : "", Settings.sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : "");
}
else if ((CMND_UPGRADE == command_code) || (CMND_UPLOAD == command_code)) {
// Check if the payload is numerically 1, and had no trailing chars.
// e.g. "1foo" or "1.2.3" could fool us.
// Check if the version we have been asked to upgrade to is higher than our current version.
// We also need at least 3 chars to make a valid version number string.
if (((1 == data_len) && (1 == payload)) || ((data_len >= 3) && NewerVersion(dataBuf))) {
ota_state_flag = 3;
// snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, Settings.ota_url);
snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, GetOtaUrl(stemp1, sizeof(stemp1)));
} else {
snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_ONE_OR_GT "\"}", command, my_version);
}
}
else if (CMND_OTAURL == command_code) {
if ((data_len > 0) && (data_len < sizeof(Settings.ota_url)))
strlcpy(Settings.ota_url, (1 == payload) ? OTA_URL : dataBuf, sizeof(Settings.ota_url));
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.ota_url);
}
else if (CMND_SERIALLOG == command_code) {
if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) {
Settings.flag.mqtt_serial = 0;
SetSeriallog(payload);
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE, command, Settings.seriallog_level, seriallog_level);
}
else if (CMND_RESTART == command_code) {
switch (payload) {
case 1:
restart_flag = 2;
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_RESTARTING);
break;
case 99:
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
EspRestart();
break;
default:
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESTART);
}
}
#ifndef BE_MINIMAL
else if ((CMND_POWERONSTATE == command_code) && (Settings.module != MOTOR)) {
/* 0 = Keep relays off after power on
* 1 = Turn relays on after power on, if PulseTime set wait for PulseTime seconds, and turn relays off
Expand Down Expand Up @@ -854,32 +911,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.pulse_counter_debounce);
}
else if (CMND_SLEEP == command_code) {
if ((payload >= 0) && (payload < 251)) {
if ((!Settings.sleep && payload) || (Settings.sleep && !payload)) restart_flag = 2;
Settings.sleep = payload;
sleep = payload;
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_UNIT_NVALUE_UNIT, command, sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : "", Settings.sleep, (Settings.flag.value_units) ? " " D_UNIT_MILLISECOND : "");
}
else if ((CMND_UPGRADE == command_code) || (CMND_UPLOAD == command_code)) {
// Check if the payload is numerically 1, and had no trailing chars.
// e.g. "1foo" or "1.2.3" could fool us.
// Check if the version we have been asked to upgrade to is higher than our current version.
// We also need at least 3 chars to make a valid version number string.
if (((1 == data_len) && (1 == payload)) || ((data_len >= 3) && NewerVersion(dataBuf))) {
ota_state_flag = 3;
// snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, Settings.ota_url);
snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_VERSION " %s " D_JSON_FROM " %s\"}", command, my_version, GetOtaUrl(stemp1, sizeof(stemp1)));
} else {
snprintf_P(mqtt_data, sizeof(mqtt_data), "{\"%s\":\"" D_JSON_ONE_OR_GT "\"}", command, my_version);
}
}
else if (CMND_OTAURL == command_code) {
if ((data_len > 0) && (data_len < sizeof(Settings.ota_url)))
strlcpy(Settings.ota_url, (1 == payload) ? OTA_URL : dataBuf, sizeof(Settings.ota_url));
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, Settings.ota_url);
}
else if (CMND_BAUDRATE == command_code) {
if (payload32 > 0) {
payload32 /= 1200; // Make it a valid baudrate
Expand Down Expand Up @@ -917,13 +948,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.serial_delimiter);
}
else if (CMND_SERIALLOG == command_code) {
if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) {
Settings.flag.mqtt_serial = 0;
SetSeriallog(payload);
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_ACTIVE_NVALUE, command, Settings.seriallog_level, seriallog_level);
}
else if (CMND_SYSLOG == command_code) {
if ((payload >= LOG_LEVEL_NONE) && (payload <= LOG_LEVEL_ALL)) {
Settings.syslog_level = payload;
Expand Down Expand Up @@ -1040,20 +1064,6 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_UNIT, command, Settings.tele_period, (Settings.flag.value_units) ? " " D_UNIT_SECOND : "");
}
else if (CMND_RESTART == command_code) {
switch (payload) {
case 1:
restart_flag = 2;
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_RESTARTING);
break;
case 99:
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
EspRestart();
break;
default:
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_ONE_TO_RESTART);
}
}
else if (CMND_RESET == command_code) {
switch (payload) {
case 1:
Expand Down Expand Up @@ -1147,6 +1157,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
I2cScan(mqtt_data, sizeof(mqtt_data));
}
#endif // USE_I2C
#endif // Not BE_MINIMAL
else type = NULL; // Unknown command
}
if (type == NULL) {
Expand Down Expand Up @@ -2142,6 +2153,7 @@ void SerialInput()
}
}

#ifdef USE_ENERGY_SENSOR
/*-------------------------------------------------------------------------------------------*\
* Sonoff S31 and Sonoff Pow R2 4800 baud serial interface
\*-------------------------------------------------------------------------------------------*/
Expand All @@ -2152,7 +2164,7 @@ void SerialInput()
return;
}
}

#endif // USE_ENERGY_SENSOR
/*-------------------------------------------------------------------------------------------*/

if (serial_in_byte > 127) { // binary data...
Expand Down
Loading

0 comments on commit 82f3723

Please sign in to comment.