diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index 406f7670..5cb7b0b9 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -660,13 +660,20 @@ void relayMQTT() { } void relayStatusWrap(unsigned char id, unsigned char value, bool is_group_topic) { - // Action to perform - if (value == 0) { - relayStatus(id, false, mqttForward(), !is_group_topic); - } else if (value == 1) { - relayStatus(id, true, mqttForward(), !is_group_topic); - } else if (value == 2) { - relayToggle(id, true, true); + switch (value) { + case 0: + relayStatus(id, false, mqttForward(), !is_group_topic); + break; + case 1: + relayStatus(id, true, mqttForward(), !is_group_topic); + break; + case 2: + relayToggle(id, true, true); + break; + default: + _relays[id].report = true; + relayMQTT(id); + break; } }