Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTA] Change topic for last update status #1561

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion main/User_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ CRGB leds2[FASTLED_IND_NUM_LEDS];
#define TimeBetweenCheckingSYS 3600 // time between (s) system checkings (like updates)
#define TimeLedON 1 // time LED are ON
#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 subjectMQTTtoSYSupdate "/commands/MQTTtoSYS/firmware_update"
#define TimeToResetAtStart 5000 // Time we allow the user at start for the reset command by button press
Expand Down
2 changes: 1 addition & 1 deletion main/ZmqttDiscovery.ino
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void pubMqttDiscovery() {
stateClassNone //State Class
);
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,
LATEST_OR_DEV, "", "", //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
Expand Down
6 changes: 3 additions & 3 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ bool checkForUpdates() {
if (!jsondata.containsKey("release_summary"))
jsondata["release_summary"] = "";
latestVersion = jsondata["latest_version"].as<String>();
pub(subjectSYStoMQTT, jsondata);
pub(subjectRLStoMQTT, jsondata);
Log.trace(F("Update file found on server" CR));
return true;
} else {
Expand Down Expand Up @@ -2201,7 +2201,7 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
JsonObject jsondata = jsonBuffer.to<JsonObject>();
jsondata["release_summary"] = "Update in progress ...";
pub(subjectSYStoMQTT, jsondata);
pub(subjectRLStoMQTT, jsondata);

const char* ota_cert = HttpsFwUpdateData["server_cert"];
if (!ota_cert) {
Expand Down Expand Up @@ -2267,7 +2267,7 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
Log.notice(F("HTTP_UPDATE_OK" CR));
jsondata["release_summary"] = "Update success !";
jsondata["installed_version"] = latestVersion;
pub(subjectSYStoMQTT, jsondata);
pub(subjectRLStoMQTT, jsondata);
ota_server_cert = ota_cert;
# ifndef ESPWifiManualSetup
saveMqttConfig();
Expand Down