From d30591d9f7697c7d24925069ef93250c0ed056e9 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Sun, 13 Feb 2022 18:47:40 +0300 Subject: [PATCH] cleanUp persistance of command topics (update libs --- lighthub/main.cpp | 44 +++++++++++++++++++++++++------------------- platformio.ini | 26 +++++++++++++------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/lighthub/main.cpp b/lighthub/main.cpp index 9b65f6a..fa45287 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -388,12 +388,30 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) char * subItem = NULL; // in Retaining status - trying to restore previous state from retained output topic. Retained input topics are not relevant. -if (lanStatus == RETAINING_COLLECTING) pfxlen=inTopic(topic,T_OUT); +if (lanStatus == RETAINING_COLLECTING) +{ + pfxlen=inTopic(topic,T_OUT); + if (!pfxlen) // There is not status topic + { + if (mqttClient.isRetained()) + { + pfxlen=inTopic(topic,T_BCST); + if (!pfxlen) pfxlen = inTopic(topic,T_DEV); + if (!pfxlen) return; // Not command topic ever + itemName=topic+pfxlen; + if (itemName[0]=='$') return;// -6; //Skipping homie stuff + debugSerial<