mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
cleanUp persistance of command topics (update libs
This commit is contained in:
@@ -388,12 +388,30 @@ void mqttCallback(char *topic, byte *payload, unsigned int length)
|
|||||||
char * subItem = NULL;
|
char * subItem = NULL;
|
||||||
|
|
||||||
// in Retaining status - trying to restore previous state from retained output topic. Retained input topics are not relevant.
|
// 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<<F("CleanUp retained topic ")<<topic<<endl;
|
||||||
|
mqttClient.deleteTopic(topic);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pfxlen=inTopic(topic,T_BCST);
|
pfxlen=inTopic(topic,T_BCST);
|
||||||
if (!pfxlen) pfxlen = inTopic(topic,T_DEV);
|
if (!pfxlen) pfxlen = inTopic(topic,T_DEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pfxlen) {
|
if (!pfxlen) {
|
||||||
debugSerial<<F("Skipping..")<<endl;
|
debugSerial<<F("Skipping..")<<endl;
|
||||||
return;// -3;
|
return;// -3;
|
||||||
@@ -406,29 +424,17 @@ else
|
|||||||
cmd_parse((char *)payload);
|
cmd_parse((char *)payload);
|
||||||
return;// -4;
|
return;// -4;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (subItem = strchr(itemName, '/'))
|
|
||||||
{
|
|
||||||
*subItem = 0;
|
|
||||||
subItem++;
|
|
||||||
if (*subItem=='$') return;// -5; //Skipping homie stuff
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemName[0]=='$') return;// -6; //Skipping homie stuff
|
|
||||||
|
|
||||||
Item item(itemName);
|
|
||||||
if (item.isValid()) {
|
|
||||||
//return
|
|
||||||
item.Ctrl((char *)payload,subItem);
|
|
||||||
} //valid item
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (itemName[0]=='$') return;// -6; //Skipping homie stuff
|
if (itemName[0]=='$') return;// -6; //Skipping homie stuff
|
||||||
//debugSerial<<F("itemName ")<<itemName<<endl;
|
//debugSerial<<F("itemName ")<<itemName<<endl;
|
||||||
Item item(itemName);
|
Item item(itemName);
|
||||||
if (item.isValid()) item.Ctrl((char *)payload);
|
if (item.isValid()) item.Ctrl((char *)payload);
|
||||||
// else debugSerial<<F("item invalid")<<endl;
|
// else debugSerial<<F("item invalid")<<endl;
|
||||||
|
if (lanStatus != RETAINING_COLLECTING && (mqttClient.isRetained()))
|
||||||
|
{
|
||||||
|
debugSerial<<F("CleanUp retained topic ")<<topic<<endl;
|
||||||
|
mqttClient.deleteTopic(topic);
|
||||||
|
}
|
||||||
|
|
||||||
return;// -7;
|
return;// -7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
; https://github.com/anklimov/Artnet.git
|
; https://github.com/anklimov/Artnet.git
|
||||||
; FastLED@3.3.2
|
; FastLED@3.3.2
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -162,7 +162,7 @@ lib_deps =
|
|||||||
https://github.com/tzapu/WiFiManager
|
https://github.com/tzapu/WiFiManager
|
||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
Streaming
|
Streaming
|
||||||
;ESP_EEPROM
|
;ESP_EEPROM
|
||||||
;https://github.com/anklimov/NRFFlashStorage
|
;https://github.com/anklimov/NRFFlashStorage
|
||||||
@@ -234,7 +234,7 @@ lib_deps =
|
|||||||
;https://github.com/zhouhan0126/WebServer-esp32.git
|
;https://github.com/zhouhan0126/WebServer-esp32.git
|
||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
Streaming
|
Streaming
|
||||||
;EEPROM
|
;EEPROM
|
||||||
;https://github.com/anklimov/NRFFlashStorage
|
;https://github.com/anklimov/NRFFlashStorage
|
||||||
@@ -309,7 +309,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/Ethernet.git
|
https://github.com/anklimov/Ethernet.git
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
SD
|
SD
|
||||||
@@ -371,7 +371,7 @@ lib_deps =
|
|||||||
;https://github.com/anklimov/DMXSerial
|
;https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet5100
|
https://github.com/anklimov/Ethernet5100
|
||||||
;5100 lib have ~90 bytes less footprint of RAM
|
;5100 lib have ~90 bytes less footprint of RAM
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
;https://github.com/anklimov/Artnet.git
|
;https://github.com/anklimov/Artnet.git
|
||||||
;FastLED@3.3.2
|
;FastLED@3.3.2
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -445,7 +445,7 @@ lib_deps =
|
|||||||
;https://github.com/anklimov/Ethernet5100
|
;https://github.com/anklimov/Ethernet5100
|
||||||
;5100 lib have ~90 bytes less footprint of RAM
|
;5100 lib have ~90 bytes less footprint of RAM
|
||||||
https://github.com/anklimov/Ethernet.git
|
https://github.com/anklimov/Ethernet.git
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
;https://github.com/anklimov/Artnet.git
|
;https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -496,7 +496,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/DMXSerial
|
https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet2
|
https://github.com/anklimov/Ethernet2
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -573,7 +573,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
https://github.com/FastLED/FastLED.git
|
https://github.com/FastLED/FastLED.git
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -629,7 +629,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/DMXSerial
|
https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet5100
|
https://github.com/anklimov/Ethernet5100
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -692,7 +692,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/Ethernet
|
https://github.com/anklimov/Ethernet
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
SD
|
SD
|
||||||
@@ -745,7 +745,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/ModbusMaster
|
https://github.com/anklimov/ModbusMaster
|
||||||
https://github.com/anklimov/DMXSerial
|
https://github.com/anklimov/DMXSerial
|
||||||
https://github.com/anklimov/Ethernet5100
|
https://github.com/anklimov/Ethernet5100
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
https://github.com/anklimov/Artnet.git
|
https://github.com/anklimov/Artnet.git
|
||||||
FastLED@3.3.2
|
FastLED@3.3.2
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
@@ -808,7 +808,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
ArduinoHttpClient
|
ArduinoHttpClient
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
Streaming
|
Streaming
|
||||||
UIPEthernet
|
UIPEthernet
|
||||||
https://github.com/anklimov/NRFFlashStorage
|
https://github.com/anklimov/NRFFlashStorage
|
||||||
@@ -869,7 +869,7 @@ lib_deps =
|
|||||||
https://github.com/anklimov/aJson
|
https://github.com/anklimov/aJson
|
||||||
https://github.com/anklimov/CmdArduino
|
https://github.com/anklimov/CmdArduino
|
||||||
ArduinoHttpClient
|
ArduinoHttpClient
|
||||||
https://github.com/knolleary/pubsubclient.git
|
https://github.com/anklimov/pubsubclient.git
|
||||||
Streaming
|
Streaming
|
||||||
Ethernet
|
Ethernet
|
||||||
https://github.com/anklimov/NRFFlashStorage
|
https://github.com/anklimov/NRFFlashStorage
|
||||||
|
|||||||
Reference in New Issue
Block a user