From 959d1054133dd1920f1d072a0042712957e0b74e Mon Sep 17 00:00:00 2001 From: stefanbode Date: Sat, 5 Aug 2023 14:51:56 +0200 Subject: [PATCH] Change shutterbutton hold behavior with grouptopic (#19263) * skip stop on hold if grouptopic If shutterbutton is defined with a grouptopic send on HOLD, there is no stop on releasing the button. All shutters will move to defined position * do not stop on hold release if group submitt If mqtt broadcast is defined on hold then release the hold button will not anymore stop the local shutter. All shutter will move to defined position --- tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino | 3 ++- tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino index 9ff0807c0..538e11fe4 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino @@ -1265,7 +1265,8 @@ bool ShutterButtonHandler(void) // handle on button release: start shutter on shortpress and stop running shutter after longpress. if (NOT_PRESSED == button && Shutter[shutter_index].direction != 0 // only act on shutters activly moving - && Button.hold_timer[button_index] > 0) // kick in on first release of botton. do not check for multipress + && Button.hold_timer[button_index] > 0 // kick in on first release of botton. do not check for multipress + && !ShutterSettings.shutter_button[button_index].position[3].mqtt_broadcast ) // do not stop on hold release if broadcast { XdrvMailbox.index = shutter_index +1; XdrvMailbox.payload = -99; // reset any payload to invalid diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino index e49c1b633..c5255c563 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino @@ -947,7 +947,11 @@ bool ShutterButtonHandler(void) if (NOT_PRESSED == button) { //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d, Button %d, hold %d, dir %d, index %d, payload %d"), shutter_index+1, button_index+1, Button.hold_timer[button_index],Shutter[shutter_index].direction,XdrvMailbox.index,XdrvMailbox.payload); - if (Shutter[shutter_index].direction && (Button.hold_timer[button_index] > 0 && (!Settings->flag.button_single || Button.hold_timer[button_index] > 20))) { + if (Shutter[shutter_index].direction + && (Button.hold_timer[button_index] > 0 + && (!Settings->flag.button_single + || Button.hold_timer[button_index] > 20)) + && !(Settings->shutter_button[button_index] & (0x01<<29))) { XdrvMailbox.index = shutter_index +1; XdrvMailbox.payload = XdrvMailbox.index; //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d, Button %d, hold %d, dir %d, index %d, payload %d"), shutter_index+1, button_index+1, Button.hold_timer[button_index],Shutter[shutter_index].direction,XdrvMailbox.index,XdrvMailbox.payload);