diff --git a/README.md b/README.md index b0a864cb5..2496aa320 100644 --- a/README.md +++ b/README.md @@ -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.1.1b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for change information. +Current version is **6.1.1c** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for release information and [sonoff/_changelog.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_changelog.ino) for change information. ### Disclaimer :warning: **DANGER OF ELECTROCUTION** :warning: diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 2f8e54b41..5c5d7ba6a 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.1.1b +/* 6.1.1c + * Add command Timers 0/1 to globally disable or enable armed timers (#3270) + * + * 6.1.1b * Add support for MPR121 controller in input mode for touch buttons (#3142) * Add support for MCP230xx for general purpose input expansion and command Sensor29 (#3188) * Fix command Scale buffer overflow (#3236) diff --git a/sonoff/settings.h b/sonoff/settings.h index 4a3dc415c..4d4192e34 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -63,7 +63,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull... uint32_t data; // Allow bit manipulation using SetOption struct { // SetOption50 .. SetOption81 - uint32_t spare00 : 1; + uint32_t timers_enable : 1; // bit 0 (v6.1.1b) uint32_t spare01 : 1; uint32_t spare02 : 1; uint32_t spare03 : 1; diff --git a/sonoff/settings.ino b/sonoff/settings.ino index d39c4e7a3..d5541298d 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -782,6 +782,9 @@ void SettingsDelta() Settings.flag.rules_once = 0; Settings.flag3.data = 0; } + if (Settings.version < 0x06010103) { + Settings.flag3.timers_enable = 1; + } Settings.version = VERSION; SettingsSave(1); diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 3bb37c5e6..7818d8170 100644 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -25,7 +25,7 @@ - Select IDE Tools - Flash Size: "1M (no SPIFFS)" ====================================================*/ -#define VERSION 0x06010102 // 6.1.1b +#define VERSION 0x06010103 // 6.1.1c // Location specific includes #include // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0) diff --git a/sonoff/xdrv_09_timers.ino b/sonoff/xdrv_09_timers.ino index 1631b5d4d..a7fae894a 100644 --- a/sonoff/xdrv_09_timers.ino +++ b/sonoff/xdrv_09_timers.ino @@ -262,7 +262,7 @@ void TimerEverySecond() { if (RtcTime.valid) { if (!RtcTime.hour && !RtcTime.minute && !RtcTime.second) { TimerSetRandomWindows(); } // Midnight - if ((uptime > 60) && (RtcTime.minute != timer_last_minute)) { // Execute from one minute after restart every minute only once + if (Settings.flag3.timers_enable && (uptime > 60) && (RtcTime.minute != timer_last_minute)) { // Execute from one minute after restart every minute only once timer_last_minute = RtcTime.minute; int16_t time = (RtcTime.hour *60) + RtcTime.minute; uint8_t days = 1 << (RtcTime.day_of_week -1); @@ -451,11 +451,15 @@ boolean TimerCommand() } } else if (CMND_TIMERS == command_code) { - if (XdrvMailbox.data_len && (XdrvMailbox.payload == 0)) { - for (byte i = 0; i < MAX_TIMERS; i++) { - Settings.timer[i].arm = 0; // Disable all timers + if (XdrvMailbox.data_len) { + if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) { + Settings.flag3.timers_enable = XdrvMailbox.payload; } } + + snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, GetStateText(Settings.flag3.timers_enable)); + MqttPublishPrefixTopic_P(RESULT_OR_STAT, command); + byte jsflg = 0; byte lines = 1; for (byte i = 0; i < MAX_TIMERS; i++) {