Fix for missing off-only MQTT messages.

Automatic WS reconnect.
This commit is contained in:
Blaz Kristan 2021-07-28 22:45:11 +02:00
parent 392df6ba72
commit 6e9a69be5c
4 changed files with 3027 additions and 3024 deletions

View File

@ -122,6 +122,7 @@ private:
*/ */
void switchStrip(bool switchOn) void switchStrip(bool switchOn)
{ {
if (m_offOnly && bri && (switchOn || (!PIRtriggered && !switchOn))) return;
PIRtriggered = switchOn; PIRtriggered = switchOn;
if (switchOn && m_onPreset) { if (switchOn && m_onPreset) {
applyPreset(m_onPreset); applyPreset(m_onPreset);
@ -227,7 +228,7 @@ public:
void loop() void loop()
{ {
// only check sensors 4x/s // 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(); lastLoop = millis();
if (!updatePIRsensorState()) { if (!updatePIRsensorState()) {

View File

@ -303,6 +303,7 @@ function showErrorToast()
if (ws && ws.readyState === WebSocket.OPEN) { if (ws && ws.readyState === WebSocket.OPEN) {
ws.close(); ws.close();
ws = null; ws = null;
setTimeout(makeWS,500);
} }
showToast('Connection to light failed!', true); showToast('Connection to light failed!', true);
} }
@ -1128,6 +1129,7 @@ function makeWS() {
ws.onopen = function(event) { ws.onopen = function(event) {
ws.send("{'v':true}"); ws.send("{'v':true}");
reqsLegal = true; reqsLegal = true;
clearErrorToast();
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2107251 #define VERSION 2107281
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG