From 6cbfb0308aede1b6d2161b51c36f377151e077ba Mon Sep 17 00:00:00 2001 From: netpok Date: Thu, 21 Feb 2019 21:28:35 +0100 Subject: [PATCH] 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 {