Call mqtt_publish_stat() after setting state, not before

This commit is contained in:
Pim van Pelt
2018-11-05 08:17:32 +01:00
parent 06241f2581
commit 02865fde72

View File

@ -335,8 +335,8 @@ void channel_override_set(int idx) {
}
if (s_channels[idx].channel_override && (match == s_channels[idx].relay_state)) {
LOG(LL_INFO, ("User state agrees with timespec, clearing override"));
mqtt_publish_stat("override", "{idx: %d, relay_state: %d, override: %B}", idx, s_channels[idx].relay_state, s_channels[idx].channel_override);
s_channels[idx].channel_override = false;
mqtt_publish_stat("override", "{idx: %d, relay_state: %d, override: %B}", idx, s_channels[idx].relay_state, s_channels[idx].channel_override);
return;
}
}
@ -348,8 +348,8 @@ void channel_override_clear(int idx) {
}
if (s_channels[idx].channel_override) {
mqtt_publish_stat("override", "{idx: %d, relay_state: %d, override: %B}", idx, s_channels[idx].relay_state, s_channels[idx].channel_override);
s_channels[idx].channel_override = false;
mqtt_publish_stat("override", "{idx: %d, relay_state: %d, override: %B}", idx, s_channels[idx].relay_state, s_channels[idx].channel_override);
}
return;
}