From 07d11c845c86ab9f9a4605306527142f61e14bfd Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Wed, 28 Jul 2021 22:50:29 +0200 Subject: [PATCH] Fix for missing off-only MQTT messages. --- usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h index 95e579926..02ecb8369 100644 --- a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h +++ b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h @@ -122,6 +122,7 @@ private: */ void switchStrip(bool switchOn) { + if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return; PIRtriggered = switchOn; if (switchOn && m_onPreset) { applyPreset(m_onPreset); @@ -227,7 +228,7 @@ public: void loop() { // only check sensors 4x/s - if (!enabled || millis() - lastLoop < 250 || strip.isUpdating() || (m_offOnly && bri && !PIRtriggered)) return; + if (!enabled || millis() - lastLoop < 250 || strip.isUpdating()) return; lastLoop = millis(); if (!updatePIRsensorState()) {