Skip to content

Commit 038c876

Browse files
Copilotdorkmo
andcommitted
Fix relay deactivation to match alarm type with trigger condition
Co-authored-by: dorkmo <[email protected]>
1 parent 9cb3877 commit 038c876

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

TankAlarm-112025-Client-BluesOpta/TankAlarm-112025-Client-BluesOpta.ino

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,9 +1557,19 @@ static void sendAlarm(uint8_t idx, const char *alarmType, float inches) {
15571557
}
15581558
} else {
15591559
// Alarm cleared - check if we should deactivate relay
1560-
// Only deactivate if mode is UNTIL_CLEAR
1560+
// Only deactivate if mode is UNTIL_CLEAR and the clearing alarm matches trigger
15611561
if (cfg.relayMode == RELAY_MODE_UNTIL_CLEAR && gRelayActiveForTank[idx]) {
1562-
shouldDeactivateRelay = true;
1562+
bool shouldClear = false;
1563+
if (cfg.relayTrigger == RELAY_TRIGGER_ANY) {
1564+
shouldClear = true; // Any alarm clearing will deactivate
1565+
} else if (cfg.relayTrigger == RELAY_TRIGGER_HIGH && strcmp(alarmType, "high") == 0) {
1566+
shouldClear = true;
1567+
} else if (cfg.relayTrigger == RELAY_TRIGGER_LOW && strcmp(alarmType, "low") == 0) {
1568+
shouldClear = true;
1569+
}
1570+
if (shouldClear) {
1571+
shouldDeactivateRelay = true;
1572+
}
15631573
}
15641574
}
15651575

0 commit comments

Comments
 (0)