Skip to content

Commit

Permalink
Merge pull request #76 from arendst/development
Browse files Browse the repository at this point in the history
v5.13.0
  • Loading branch information
ascillato authored Apr 30, 2018
2 parents e7854bb + 962a504 commit 9a38924
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 118 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,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 **5.12.0o** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
Current version is **5.13.0** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.

### Quick install
Download one of the released binaries from https://github.com/arendst/Sonoff-Tasmota/releases and flash it to your hardware as documented in the wiki.
Expand Down
185 changes: 73 additions & 112 deletions sonoff/_releasenotes.ino
Original file line number Diff line number Diff line change
@@ -1,117 +1,49 @@
/* 5.12.0o
* Fix Energy Today and Yesterday overflow (#2543)
*
* 5.12.0n
/* 5.13.0 20180430
* Change platformio option sonoff-ds18x20 to sonoff-allsensors enabling ds18x20 and all other sensors in one image
* Change status display of Ssid and SetOption
* Change default option SetOption15 from 0 to 1 providing better initial PWM experience
* Change webpage parameter communication
* Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing
* Change TSL2561 driver to joba library and delete Adafruit library (#1644)
* Change default parameters in user_config.h to undefined for easy installation (#1851)
* Change max user configurable hold time from 10 to 25 seconds (#1851)
* Change Sonoff SC JSON format (#1939)
* Change Polish language to using Diacritics (#2005)
* Change user_config_override usage by providing user_config_override_sample.h (#2228)
* Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
* Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
* Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accomodate rules (#2560)
* Change Counter JSON message from {"Counter1":0,"Counter3":0} to {"COUNTER":{"C1":0,"C3":0}} to accomodate rules
* Change ADS1115 JSON message from {"ADS1115":{"Analog0":123,"Analog1":123}} to {"ADS1115":{"A0":123,"A1":123}}
* Add ANALOG#A0div10 trigger to rules to be used in rule like on analog#a0div10 do publish cmnd/ailight/dimmer %value% endon
*
* 5.12.0m
* Reinit timers to accomodate random window (#2447)
* Remove sonoff-xxl
* Disable sleep when using Esp/Arduino core 2.4.1 (#2559)
* Add sonoff-classic, sonoff-allsensors and sonoff-knx
* Add some coloring to important web buttons
* Add rule variables and teleperiod trigger to accomodate user HA messages
* Add define MQTT_TELE_RETAIN compile option default set to 0 (#1071)
* Add user selectable defines for Sunrise/set Dawn option (#2378)
* Add random window to timers (#2447)
* Add optional KNX IP Protocol Support (#2402)
* Add Greek language file (#2491)
* Add Bulgarian language file
* Add support for sensor HC-SR04 ultrasonic (#113, #1964, #2444)
* Add support for Sonoff Pow R2 (#2340)
* Add GPIO_User to GPIO02 for all Sonoff T1 (#2524)
* Fix compile error when using ESP/Arduino library v2.3.0 by reverting KNX async UDP library to default UDP library (#2488, #2492, #2493)
* Fix configuration filename truncation when it contains spaces (#2484, #2490)
*
* 5.12.0l
* Release rules up to 511 characters
* Prepare for feature release - call on translators to update their language files
* Add timer sunrise and sunset offset (#2378)
* Fix negative Latitude and Longitude value entry (#2461)
* Fix sunrise and sunset calculation (#2461)
*
* 5.12.0k
* Prepare for simple rules of up to 255 characters by enlarging Settings area to now 2048 bytes
* Change Timer parameter name from Power to Action
* Add commands Publish, Rule, RuleTimer and Event. See Wiki about Rule restriction, usage and examples
* Fix intermittent exception when dns lookup is used while sleep is enabled
* Fix 5.4.0 regression turning off single press after button hold during 4x hold time
* Fix possible wifi connection problem by erasing sdk configuration parameters
* Fix NTP sync to Thu Jan 01 08:00:10 1970 results in uptime 17651+ days (core2.4.1/sdk2.2.1)
* Fix MAX31850 higher temperatures (#1269)
* Fix freeing more code space when emulation is disabled (#1592)
* Fix providing web page configuratin option for Friendly Name when no device (relay or light) is configured (#1850)
* Fix compile error when define HOME_ASSISTANT_DISCOVERY_ENABLE is not set (#1937)
* Fix MQTT TLS fingerprint validation (#2033)
* Fix update temperature on DS18x20 drivers (#2328)
* Fix compile error when not defined USE_TIMERS (#2400)
*
* 5.12.0j
* Add optional Sunrise and Sunset timers with commands Latitide and Longitude to be enabled with define USE_SUNRISE in user_config.h (#2317)
*
* 5.12.0i
* Fix configuration filename truncation when it contains spaces (#2484, #2490)
* Fix Energy Today and Yesterday overflow (#2543)
* Add serial debug info
* Add Portuguese language file
* Add Czech language file
* Add Bulgarian language file
* Add Domoticz dust (custom) sensors to PMS5003 and NovaFitness SDS drivers as PM1, PM2.5 and PM10
* Add commands Publish, Rule, RuleTimer and Event. See Wiki about Rule restriction, usage and examples
* Add sonoff-classic, sonoff-allsensors and sonoff-knx
* Add some coloring to important web buttons
* Add support for sensor HC-SR04 ultrasonic (#113, #1964, #2444)
* Add define MQTT_TELE_RETAIN compile option default set to 0 (#1071)
* Add 16 timers using commands Timer and Timers (#1091)
* Add commands Timer 0 to clear timer and Timer 1..16 to copy timer
* Add optional Timer configuration webpage to be enabled in user_config.h with define USE_TIMERS_WEB
* Add hexadecimal Data entry to command IrSend using 0x notation (#1290, #2314)
* Add Multichannel Gas sensor using MultiChannel_Gas_Sensor library (#1245)
* Add Domoticz Battery and RSSI Quality (#1604)
* Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277)
* Add support for SGP30 gas and air quality sensor (#2307)
* Add multiple color entry support for command Led like Led2 120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue (#2303)
* Add hexadecimal RGB color entry on RGBCW leds (#2304)
* Change webpage parameter communication
* Change Timer parameter Device to more obvious Output
* Change max number of commands in Backlog from 15 to 30 and ignore commands overflowing
* Change user_config_override usage by providing user_config_override_sample.h (#2228)
* Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
* Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
*
* 5.12.0h
* Add optional Arduino OTA support to be enabled in user_config.h (#1998)
* Add support for Software Serial bridge using commands SerialDelimiter, SBaudrate and SSerialSend. Supports 8N1 and text only (#2190)
* Add support for Hardware Serial bridge using commands SerialDelimiter, Baudrate and SerialSend. Supports 8N1 and text only (#2182)
* Add support for Zengge WF017 PWM Led strip controller (#2202)
* Add PWM status to command State if PWM enabled (#2203)
* Add command HSBColor Hue,Sat,Bri (#1642, #2203)
* Add command Channel 0..100 to control dimmer value for individual color channels (#2111, #2203)
* Add Channel status information (#2211)
* Add all FriendlyNames to Status information (#2208)
* Change status display of Ssid and SetOption
* Change default option SetOption15 from 0 to 1 providing better initial PWM experience
*
* 5.12.0f
* Add compile time support for WS2812 BRG and RBG led configurations to be defined in user_config.h (#1690)
*
* 5.12.0e
* Add Domoticz dust (custom) sensors to PMS5003 and NovaFitness SDS drivers as PM1, PM2.5 and PM10
* Add a second TLS fingerprint to allow switching keys in TLS mode (#2033, #2102)
* Add display of remaining pulse time to command PulseTime (#2085)
* Add additional time offset to Wifi Retry based on device mac address (#2089)
* Add command Color6 RRGGBB for Clock hour marker color and command Rotation pixels for Clock rotation (#2092)
* Add HTML language header in local language (#2123)
* Add command PowerDelta 0..100 (percentage) to Energy monitoring devices to report on active power load change (#2157)
* Add Restart Reason to Status 1 report (#2161)
* Fix MAX31850 higher temperatures (#1269)
*
* 5.12.0d
* Add support for optional MQTT drivers to be selected in user_config.h (#1992)
* Add Portuguese language file
* Add compiler check for stable lwIP version v1.4 (#1940)
* Add always suffix with device number in Mqtt discovery topic (#1962)
* Add diacritics to Polish language file (#2005)
* Add Hungarian language file (#2024)
* Add Czech language file
* Add Chinese (Traditional) in Taiwan language file (#2108)
* Add support for Nova Fitness SDS011 and possibly SDS021 particle concentration sensor (#2070)
* Add single decimal precision to Nova Fitness SDS0x1 sensor values (#2093)
* Add support for multiple SHT3X sensors (#1949, #2110)
* Add Sonoff SC domoticz support for Sound level as Counter and Air quality (#2118)
* Fix MQTT TLS fingerprint validation (#2033)
*
* 5.12.0c
* Fix intermittent exception when dns lookup is used while sleep is enabled
* Fix 5.4.0 regression turning off single press after button hold during 4x hold time
* Fix possible wifi connection problem by erasing sdk configuration parameters
* Change Polish language to using Diacritics (#2005)
*
* 5.12.0b
* Add serial debug info
* Add Multichannel Gas sensor using MultiChannel_Gas_Sensor library (#1245)
* Add optional usage of %d or %X suffices in MQTT client to append chipid (#1871)
* Add optional usage of %d or %X suffices in MQTT topic to append chipid (#1871)
* Add optional usage of %d or %04d in ota url to be replaced with chipid (#1871)
Expand All @@ -121,17 +53,46 @@
* Add Webserver upload preflight request support (#1927)
* Add Home Assistant clear other device (#1931)
* Add Restart time to Status 1 (#1938)
* Change TSL2561 driver to joba library and delete Adafruit library (#1644)
* Change Sonoff SC JSON format (#1939)
* Fix compile error when define HOME_ASSISTANT_DISCOVERY_ENABLE is not set (#1937)
* Add optional TSL2561 driver using library Joba_Tsl2561 to be enabled in user_config.h with define USE_TSL2561_JOBA (#1951)
* Add support for sensor SHTC3 (#1967)
*
* 5.12.0a
* Change platformio option sonoff-ds18x20 to sonoff-allsensors enabling ds18x20 and all other sensors in one image
* Fix providing web page configuratin option for Friendly Name when no device (relay or light) is configured (#1850)
* Change default parameters in user_config.h to undefined for easy installation (#1851)
* Change max user configurable hold time from 10 to 25 seconds (#1851)
* Add compiler check for stable lwIP version v1.4 (#1940)
* Add support for multiple SHT3X sensors (#1949, #2110)
* Add always suffix with device number in Mqtt discovery topic (#1962)
* Add support for optional MQTT drivers to be selected in user_config.h (#1992)
* Add optional Arduino OTA support to be enabled in user_config.h (#1998)
* Add diacritics to Polish language file (#2005)
* Add Hungarian language file (#2024)
* Add support for Nova Fitness SDS011 and possibly SDS021 particle concentration sensor (#2070)
* Add single decimal precision to Nova Fitness SDS0x1 sensor values (#2093)
* Add Chinese (Traditional) in Taiwan language file (#2108)
* Add Sonoff SC domoticz support for Sound level as Counter and Air quality (#2118)
* Add a second TLS fingerprint to allow switching keys in TLS mode (#2033, #2102)
* Add display of remaining pulse time to command PulseTime (#2085)
* Add additional time offset to Wifi Retry based on device mac address (#2089)
* Add command Color6 RRGGBB for Clock hour marker color and command Rotation pixels for Clock rotation (#2092)
* Add HTML language header in local language (#2123)
* Add command PowerDelta 0..100 (percentage) to Energy monitoring devices to report on active power load change (#2157)
* Add Restart Reason to Status 1 report (#2161)
* Add command Channel 0..100 to control dimmer value for individual color channels (#2111, #2203)
* Add support for Hardware Serial bridge using commands SerialDelimiter, Baudrate and SerialSend. Supports 8N1 and text only (#2182)
* Add support for Software Serial bridge using commands SerialDelimiter, SBaudrate and SSerialSend. Supports 8N1 and text only (#2190)
* Add support for Zengge WF017 PWM Led strip controller (#2202)
* Add PWM status to command State if PWM enabled (#2203)
* Add all FriendlyNames to Status information (#2208)
* Add Channel status information (#2211)
* Add hexadecimal Data entry to command IrSend using 0x notation (#1290, #2314)
* Add Home Assistant MQTT Discovery for Buttons and change SetOption19 response (#2277)
* Add multiple color entry support for command Led like Led2 120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue (#2303)
* Add hexadecimal RGB color entry on RGBCW leds (#2304)
* Add support for SGP30 gas and air quality sensor (#2307)
* Add optional Sunrise and Sunset timers with commands Latitide and Longitude to be enabled with define USE_SUNRISE in user_config.h (#2317)
* Add timer sunrise and sunset offset (#2378)
* Add user selectable defines for Sunrise/set Dawn option (#2378)
* Add optional KNX IP Protocol Support (#2402)
* Add random window to timers (#2447)
* Add Greek language file (#2491)
* Add support for Sonoff Pow R2 (#2340)
* Add GPIO_User to GPIO02 for all Sonoff T1 (#2524)
*
* 5.12.0 20180209
* Change library PubSubClient.h define MQTT_MAX_PACKET_SIZE from 512 to 1000 for Home Assistant support
Expand Down
2 changes: 1 addition & 1 deletion 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 0x050C000F // 5.12.0o
#define VERSION 0x050D0000 // 5.13.0

// Location specific includes
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
Expand Down
2 changes: 1 addition & 1 deletion sonoff/support.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ void RtcSecond()
uint8_t offset = (uptime < 30) ? RtcTime.second : (((ESP.getChipId() & 0xF) * 3) + 3) ; // First try ASAP to sync. If fails try once every 60 seconds based on chip id
if ((WL_CONNECTED == WiFi.status()) && (offset == RtcTime.second) && ((RtcTime.year < 2016) || (ntp_sync_minute == RtcTime.minute))) {
ntp_time = sntp_get_current_timestamp();
if (ntp_time) {
if (ntp_time > 1451602800) { // Fix NTP bug in core 2.4.1/SDK 2.2.1 (returns Thu Jan 01 08:00:10 1970 after power on)
utc_time = ntp_time;
ntp_sync_minute = 60; // Sync so block further requests
if (restart_time == 0) {
Expand Down
14 changes: 11 additions & 3 deletions sonoff/xdrv_03_energy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ float energy_power_factor = 0; // 0.12
float energy_daily = 0; // 123.123 kWh
float energy_total = 0; // 12345.12345 kWh
float energy_start = 0; // 12345.12345 kWh total previous
unsigned long energy_kWhtoday_delta = 0; // 1212312345 Wh 10^-5 (deca micro Watt hours) - Overflows to energy_kWhtoday (HLW and CSE only)
unsigned long energy_kWhtoday; // 12312312 Wh * 10^-2 (deca milli Watt hours) - 5764 = 0.05764 kWh = 0.058 kWh = energy_daily
unsigned long energy_period = 0; // 12312312 Wh * 10^-2 (deca milli Watt hours) - 5764 = 0.05764 kWh = 0.058 kWh = energy_daily


float energy_power_last[3] = { 0 };
uint8_t energy_power_delta = 0;

Expand Down Expand Up @@ -82,6 +82,11 @@ Ticker ticker_energy;

void EnergyUpdateToday()
{
if (energy_kWhtoday_delta > 1000) {
unsigned long delta = energy_kWhtoday_delta / 1000;
energy_kWhtoday_delta -= (delta * 1000);
energy_kWhtoday += delta;
}
RtcSettings.energy_kWhtoday = energy_kWhtoday;
energy_daily = (float)energy_kWhtoday / 100000;
energy_total = (float)(RtcSettings.energy_kWhtotal + energy_kWhtoday) / 100000;
Expand Down Expand Up @@ -157,7 +162,7 @@ void HlwEverySecond()
hlw_len = 10000 / hlw_energy_period_counter;
hlw_energy_period_counter = 0;
if (hlw_len) {
energy_kWhtoday += ((HLW_PREF * Settings.energy_power_calibration) / hlw_len) / 36000;
energy_kWhtoday_delta += ((HLW_PREF * Settings.energy_power_calibration) / hlw_len) / 36;
EnergyUpdateToday();
}
}
Expand Down Expand Up @@ -391,7 +396,7 @@ void CseEverySecond()
}
if (cf_frequency && energy_power) {
cf_pulses_last_time = cf_pulses;
energy_kWhtoday += (cf_frequency * Settings.energy_power_calibration) / 36000;
energy_kWhtoday_delta += (cf_frequency * Settings.energy_power_calibration) / 36;
EnergyUpdateToday();
}
}
Expand Down Expand Up @@ -583,6 +588,7 @@ void Energy200ms()
Settings.energy_kWhtotal += energy_kWhtoday;
RtcSettings.energy_kWhtotal = Settings.energy_kWhtotal;
energy_kWhtoday = 0;
energy_kWhtoday_delta = 0;
energy_period = energy_kWhtoday;
EnergyUpdateToday();
energy_max_energy_state = 3;
Expand Down Expand Up @@ -853,6 +859,7 @@ boolean EnergyCommand()
switch (XdrvMailbox.index) {
case 1:
energy_kWhtoday = lnum *100;
energy_kWhtoday_delta = 0;
energy_period = energy_kWhtoday;
Settings.energy_kWhtoday = energy_kWhtoday;
RtcSettings.energy_kWhtoday = energy_kWhtoday;
Expand Down Expand Up @@ -1041,6 +1048,7 @@ void EnergySnsInit()

if (energy_flg) {
energy_kWhtoday = (RtcSettingsValid()) ? RtcSettings.energy_kWhtoday : (RtcTime.day_of_year == Settings.energy_kWhdoy) ? Settings.energy_kWhtoday : 0;
energy_kWhtoday_delta = 0;
energy_period = energy_kWhtoday;
EnergyUpdateToday();
ticker_energy.attach_ms(200, Energy200ms);
Expand Down

0 comments on commit 9a38924

Please sign in to comment.