From 56b0f6efdc92390cc4f2c04e39e9236e1709615f Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 11 Sep 2019 12:14:37 +0200 Subject: [PATCH] Fix interlocked relays turning off Fix interlocked relays turning off (#6385) --- sonoff/sonoff.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 6a60ff49e..ff771c95e 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -581,8 +581,11 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source) MqttPublishPowerBlinkState(device); } - if (Settings.flag.interlock && !interlock_mutex) { // Clear all but masked relay in interlock group - interlock_mutex = true; + if (Settings.flag.interlock && + !interlock_mutex && + ((POWER_ON == state) || ((POWER_TOGGLE == state) && !(power & mask))) + ) { + interlock_mutex = true; // Clear all but masked relay in interlock group if new set requested for (uint32_t i = 0; i < MAX_INTERLOCKS; i++) { if (Settings.interlock[i] & mask) { // Find interlock group for (uint32_t j = 0; j < devices_present; j++) {