mirror of
https://github.com/wled/WLED.git
synced 2025-07-10 12:26:31 +00:00
Fix for incorrect move of MQTT publish
This commit is contained in:
parent
13d5deddec
commit
9e9b1c3c98
@ -226,7 +226,6 @@ void PIRsensorSwitch::switchStrip(bool switchOn)
|
|||||||
if (PIRtriggered && switchOn) return; //if already on and triggered before, do nothing
|
if (PIRtriggered && switchOn) return; //if already on and triggered before, do nothing
|
||||||
PIRtriggered = switchOn;
|
PIRtriggered = switchOn;
|
||||||
DEBUG_PRINT(F("PIR: strip=")); DEBUG_PRINTLN(switchOn?"on":"off");
|
DEBUG_PRINT(F("PIR: strip=")); DEBUG_PRINTLN(switchOn?"on":"off");
|
||||||
publishMqtt(switchOn);
|
|
||||||
if (switchOn) {
|
if (switchOn) {
|
||||||
if (m_onPreset) {
|
if (m_onPreset) {
|
||||||
if (currentPlaylist>0 && !offMode) {
|
if (currentPlaylist>0 && !offMode) {
|
||||||
@ -337,11 +336,12 @@ bool PIRsensorSwitch::updatePIRsensorState()
|
|||||||
offTimerStart = 0;
|
offTimerStart = 0;
|
||||||
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()))) switchStrip(true);
|
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()))) switchStrip(true);
|
||||||
else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
|
else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
|
||||||
//publishMqtt("on");
|
publishMqtt(true);
|
||||||
} else {
|
} else {
|
||||||
// start switch off timer
|
// start switch off timer
|
||||||
offTimerStart = millis();
|
offTimerStart = millis();
|
||||||
if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
|
if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
|
||||||
|
publishMqtt(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -352,11 +352,8 @@ bool PIRsensorSwitch::handleOffTimer()
|
|||||||
{
|
{
|
||||||
if (offTimerStart > 0 && millis() - offTimerStart > m_switchOffDelay) {
|
if (offTimerStart > 0 && millis() - offTimerStart > m_switchOffDelay) {
|
||||||
offTimerStart = 0;
|
offTimerStart = 0;
|
||||||
if (enabled == true) {
|
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()) || PIRtriggered)) switchStrip(false);
|
||||||
if (!m_mqttOnly && (!m_nightTimeOnly || (m_nightTimeOnly && !isDayTime()) || PIRtriggered)) switchStrip(false);
|
else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND); // update countdown timer
|
||||||
else if (NotifyUpdateMode != CALL_MODE_NO_NOTIFY) updateInterfaces(CALL_MODE_WS_SEND);
|
|
||||||
//publishMqtt("off");
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user