From b92b59b2b108343ca809d0815813d2cb1cf0ac13 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 25 Oct 2020 12:59:24 +0100 Subject: [PATCH] Add command ``SetOption113 1`` Add command ``SetOption113 1`` to set dimmer low on rotary dial after power off (#8263) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/settings.h | 2 +- tasmota/support_rotary.ino | 9 ++++++++- tools/decode-status.py | 5 +++-- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53bd16e86..b99347572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544) - Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593) - Command ``ShutterChange`` to increment change position (#9594) +- Command ``SetOption113 1`` to set dimmer low on rotary dial after power off - Support for EZO Ph and ORP sensors by Christopher Tremblay (#9567) - Support for EZO RTD sensors by Christopher Tremblay (#9585) - Support for EZO HUM sensors by Christopher Tremblay (#9599) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 929e8259a..be34664ec 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -62,6 +62,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota - Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544) - Command ``SwitchMode 15`` sending only MQTT message on switch change (#9593) - Command ``ShutterChange`` to increment change position (#9594) +- Command ``SetOption113 1`` to set dimmer low on rotary dial after power off - Zigbee command ``ZbData`` for better support of device specific data - Optional support for Mitsubishi Electric HVAC by David Gwynne (#9237) - Optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353) diff --git a/tasmota/settings.h b/tasmota/settings.h index 3b409b6bd..d75c40bcd 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -132,7 +132,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t zb_disable_autobind : 1; // bit 28 (v8.5.0.1) - SetOption110 - disable Zigbee auto-config when pairing new devices uint32_t buzzer_freq_mode : 1; // bit 29 (v8.5.0.1) - SetOption111 - Use frequency output for buzzer pin instead of on/off signal uint32_t zb_topic_fname : 1; // bit 30 (v8.5.0.1) - SetOption112 - Use friendly name in zigbee topic (use with SetOption89) - uint32_t spare31 : 1; // bit 31 + uint32_t rotary_poweron_dimlow : 1; // bit 31 (v9.0.0.2) - SetOption113 - Set dimmer low on rotary dial after power off }; } SysBitfield4; diff --git a/tasmota/support_rotary.ino b/tasmota/support_rotary.ino index e04c36faa..fca1a4dc2 100644 --- a/tasmota/support_rotary.ino +++ b/tasmota/support_rotary.ino @@ -198,7 +198,14 @@ void RotaryHandler(void) { } } } else { // Dimmer RGBCW or RGB only if second rotary - LightDimmerOffset(second_rotary ? 1 : 0, rotary_position * rotary_dimmer_increment[Rotary.model]); + uint32_t dimmer_index = second_rotary ? 1 : 0; + if (!Settings.flag4.rotary_poweron_dimlow || power) { // SetOption113 - On rotary dial after power off set dimmer low + LightDimmerOffset(dimmer_index, rotary_position * rotary_dimmer_increment[Rotary.model]); + } else { + if (rotary_position > 0) { // Only power on if rotary increase + LightDimmerOffset(dimmer_index, -LightGetDimmer(dimmer_index) +1); + } + } } } else { // Rotary2 if (button_pressed) { // Color Temperature diff --git a/tools/decode-status.py b/tools/decode-status.py index 6826f3afc..1bff40a71 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -165,7 +165,8 @@ a_setoption = [[ "Force gen1 Alexa mode", "Disable Zigbee auto-config when pairing new devices", "Use frequency output for buzzer pin instead of on/off signal", - "","" + "Use friendly name in zigbee topic (use with SetOption89)", + "Set dimmer low on rotary dial after power off" ],[ "","","","", "","","","", @@ -267,7 +268,7 @@ else: obj = json.load(fp) def StartDecode(): - print ("\n*** decode-status.py v20201024 by Theo Arends and Jacek Ziolkowski ***") + print ("\n*** decode-status.py v20201025 by Theo Arends and Jacek Ziolkowski ***") # print("Decoding\n{}".format(obj))