From b3adab40979b6882bab6f8a8277e84f23f112805 Mon Sep 17 00:00:00 2001 From: netpok Date: Thu, 21 Feb 2019 21:27:52 +0100 Subject: [PATCH 1/2] Add flag for no hold retain --- sonoff/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonoff/settings.h b/sonoff/settings.h index bc39d7d8a..447db10c0 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -75,7 +75,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t hass_tele_on_power : 1; // bit 9 (v6.3.0.13) uint32_t sleep_normal : 1; // bit 10 (v6.3.0.15) - SetOption60 - Enable normal sleep instead of dynamic sleep uint32_t button_switch_force_local : 1;// bit 11 (v6.3.0.16) - SetOption61 - Force local operation when button/switch topic is set - uint32_t spare12 : 1; + uint32_t no_hold_retain : 1; // bit 12 (v6.4.1.19) - SetOption62 - Don't use retain flag on HOLD messages uint32_t spare13 : 1; uint32_t spare14 : 1; uint32_t spare15 : 1; From 6cbfb0308aede1b6d2161b51c36f377151e077ba Mon Sep 17 00:00:00 2001 From: netpok Date: Thu, 21 Feb 2019 21:28:35 +0100 Subject: [PATCH 2/2] Check no hold retain flag on hold action sending --- sonoff/sonoff.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 24a3d5723..5cb6379f9 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -1434,10 +1434,10 @@ bool SendKey(uint8_t key, uint8_t device, uint8_t state) } #ifdef USE_DOMOTICZ if (!(DomoticzSendKey(key, device, state, strlen(mqtt_data)))) { - MqttPublishDirect(stopic, (key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain); + MqttPublishDirect(stopic, ((key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain) && (state != 3 || !Settings.flag3.no_hold_retain)); } #else - MqttPublishDirect(stopic, (key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain); + MqttPublishDirect(stopic, ((key) ? Settings.flag.mqtt_switch_retain : Settings.flag.mqtt_button_retain) && (state != 3 || !Settings.flag3.no_hold_retain)); #endif // USE_DOMOTICZ result = !Settings.flag3.button_switch_force_local; } else {