[OTA] Change topic for last update status (#1561)
To avoid conflict with the SYStoMQTT information
This commit is contained in:
1 parent
e1fef642cd
commit
b7b3bbb91a
3 files changed
+6
-5
No files matched your search
+2
-1
@@ -615,7 +615,8 @@ CRGB leds2[FASTLED_IND_NUM_LEDS];
|
|||||||
#define TimeBetweenCheckingSYS 3600 // time between (s) system checkings (like updates)
|
#define TimeBetweenCheckingSYS 3600 // time between (s) system checkings (like updates)
|
||||||
#define TimeLedON 1 // time LED are ON
|
#define TimeLedON 1 // time LED are ON
|
||||||
#define InitialMQTTConnectionTimeout 10 // time estimated (s) before the board is connected to MQTT
|
#define InitialMQTTConnectionTimeout 10 // time estimated (s) before the board is connected to MQTT
|
||||||
#define subjectSYStoMQTT "/SYStoMQTT"
|
#define subjectSYStoMQTT "/SYStoMQTT" // system parameters
|
||||||
|
#define subjectRLStoMQTT "/RLStoMQTT" // latest release information
|
||||||
#define subjectMQTTtoSYSset "/commands/MQTTtoSYS/config"
|
#define subjectMQTTtoSYSset "/commands/MQTTtoSYS/config"
|
||||||
#define subjectMQTTtoSYSupdate "/commands/MQTTtoSYS/firmware_update"
|
#define subjectMQTTtoSYSupdate "/commands/MQTTtoSYS/firmware_update"
|
||||||
#define TimeToResetAtStart 5000 // Time we allow the user at start for the reset command by button press
|
#define TimeToResetAtStart 5000 // Time we allow the user at start for the reset command by button press
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ void pubMqttDiscovery() {
|
|||||||
stateClassNone //State Class
|
stateClassNone //State Class
|
||||||
);
|
);
|
||||||
createDiscovery("update", //set Type
|
createDiscovery("update", //set Type
|
||||||
subjectSYStoMQTT, "SYS: Firmware Update", (char*)getUniqueId("update", "").c_str(), //set state_topic,name,uniqueId
|
subjectRLStoMQTT, "SYS: Firmware Update", (char*)getUniqueId("update", "").c_str(), //set state_topic,name,uniqueId
|
||||||
will_Topic, "firmware", "", //set availability_topic,device_class,value_template,
|
will_Topic, "firmware", "", //set availability_topic,device_class,value_template,
|
||||||
LATEST_OR_DEV, "", "", //set,payload_on,payload_off,unit_of_meas,
|
LATEST_OR_DEV, "", "", //set,payload_on,payload_off,unit_of_meas,
|
||||||
0, //set off_delay
|
0, //set off_delay
|
||||||
|
|||||||
+3
-3
@@ -2136,7 +2136,7 @@ bool checkForUpdates() {
|
|||||||
if (!jsondata.containsKey("release_summary"))
|
if (!jsondata.containsKey("release_summary"))
|
||||||
jsondata["release_summary"] = "";
|
jsondata["release_summary"] = "";
|
||||||
latestVersion = jsondata["latest_version"].as<String>();
|
latestVersion = jsondata["latest_version"].as<String>();
|
||||||
pub(subjectSYStoMQTT, jsondata);
|
pub(subjectRLStoMQTT, jsondata);
|
||||||
Log.trace(F("Update file found on server" CR));
|
Log.trace(F("Update file found on server" CR));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -2201,7 +2201,7 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
|
|||||||
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
|
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
|
||||||
JsonObject jsondata = jsonBuffer.to<JsonObject>();
|
JsonObject jsondata = jsonBuffer.to<JsonObject>();
|
||||||
jsondata["release_summary"] = "Update in progress ...";
|
jsondata["release_summary"] = "Update in progress ...";
|
||||||
pub(subjectSYStoMQTT, jsondata);
|
pub(subjectRLStoMQTT, jsondata);
|
||||||
|
|
||||||
const char* ota_cert = HttpsFwUpdateData["server_cert"];
|
const char* ota_cert = HttpsFwUpdateData["server_cert"];
|
||||||
if (!ota_cert) {
|
if (!ota_cert) {
|
||||||
@@ -2267,7 +2267,7 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
|
|||||||
Log.notice(F("HTTP_UPDATE_OK" CR));
|
Log.notice(F("HTTP_UPDATE_OK" CR));
|
||||||
jsondata["release_summary"] = "Update success !";
|
jsondata["release_summary"] = "Update success !";
|
||||||
jsondata["installed_version"] = latestVersion;
|
jsondata["installed_version"] = latestVersion;
|
||||||
pub(subjectSYStoMQTT, jsondata);
|
pub(subjectRLStoMQTT, jsondata);
|
||||||
ota_server_cert = ota_cert;
|
ota_server_cert = ota_cert;
|
||||||
# ifndef ESPWifiManualSetup
|
# ifndef ESPWifiManualSetup
|
||||||
saveMqttConfig();
|
saveMqttConfig();
|
||||||
|
|||||||
Reference in new issue
Block a user