-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use single topic for MQTT client status (LWT, birth, etc.) (#435)
* Update test for new MQTT client status approach * Refactor About helper to support outputing JSON * Use single topic for client status * Web UI: Use single topic for client status * Add platformio autogenerated file * increase MQTT buffer from 200 -> 250 to make room for larger LWT messages
- Loading branch information
Showing
13 changed files
with
111 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
.piolibdeps | ||
.clang_complete | ||
.gcc-flags.json | ||
.sconsign.dblite | ||
/web/node_modules | ||
/web/build | ||
/dist/*.bin | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <AboutHelper.h> | ||
#include <ArduinoJson.h> | ||
#include <Settings.h> | ||
#include <ESP8266WiFi.h> | ||
|
||
String AboutHelper::generateAboutString(bool abbreviated) { | ||
DynamicJsonBuffer buffer; | ||
JsonObject& response = buffer.createObject(); | ||
|
||
generateAboutObject(response, abbreviated); | ||
|
||
String body; | ||
response.printTo(body); | ||
|
||
return body; | ||
} | ||
|
||
void AboutHelper::generateAboutObject(JsonObject& obj, bool abbreviated) { | ||
obj["firmware"] = QUOTE(FIRMWARE_NAME); | ||
obj["version"] = QUOTE(MILIGHT_HUB_VERSION); | ||
obj["ip_address"] = WiFi.localIP().toString(); | ||
obj["reset_reason"] = ESP.getResetReason(); | ||
|
||
if (! abbreviated) { | ||
obj["variant"] = QUOTE(FIRMWARE_VARIANT); | ||
obj["free_heap"] = ESP.getFreeHeap(); | ||
obj["arduino_version"] = ESP.getCoreVersion(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
#include <Arduino.h> | ||
#include <ArduinoJson.h> | ||
|
||
#ifndef _ABOUT_STRING_HELPER_H | ||
#define _ABOUT_STRING_HELPER_H | ||
|
||
class AboutStringHelper { | ||
class AboutHelper { | ||
public: | ||
static String generateAboutString(bool abbreviated = false); | ||
static void generateAboutObject(JsonObject& obj, bool abbreviated = false); | ||
}; | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.