-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor MQTT interface and extend with autodiscovery + preparing tls…
… support
- Loading branch information
Showing
8 changed files
with
296 additions
and
89 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
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,32 @@ | ||
#ifndef MQTTHANDLER_H | ||
#define MQTTHANDLER_H | ||
|
||
#include <ESP8266WiFi.h> | ||
#include <PubSubClient.h> | ||
#include <WiFiClientSecure.h> | ||
|
||
class MQTTHandler { | ||
public: | ||
MQTTHandler(const char* broker, int port, const char* user, const char* password, bool useTLS, const char* sensorUniqueName); | ||
void setup(bool autoDiscovery); | ||
void loop(bool autoDiscovery); | ||
void publishDiscoveryMessage(const char* sensor_type, const char* location, const char* unit); | ||
void publishSensorData(String typeName, String value); | ||
void publishStandardData(String topicPath, String value); | ||
|
||
private: | ||
const char* mqtt_broker; | ||
int mqtt_port; | ||
const char* mqtt_user; | ||
const char* mqtt_password; | ||
bool useTLS; | ||
const char* sensor_uniqeName; | ||
|
||
WiFiClient wifiClient; | ||
WiFiClientSecure wifiClientSecure; | ||
PubSubClient client; | ||
|
||
void reconnect(bool autoDiscovery); | ||
}; | ||
|
||
#endif // MQTTHANDLER_H |
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,3 +1,3 @@ | ||
#define VERSION "1.6.0_localDev" | ||
#define BUILDTIME "06.06.2024 - 00:11:48" | ||
#define BUILDTIMESTAMP "1717625508" | ||
#define BUILDTIME "06.06.2024 - 22:00:02" | ||
#define BUILDTIMESTAMP "1717704002" |
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,6 +1,6 @@ | ||
{ | ||
"version": "1.6.0_localDev", | ||
"versiondate": "06.06.2024 - 00:11:48", | ||
"versiondate": "06.06.2024 - 22:00:02", | ||
"linksnapshot": "https://github.com/ohAnd/dtuGateway/releases/download/snapshot/dtuGateway_snapshot_1.6.0_localDev.bin", | ||
"link": "https://github.com/ohAnd/dtuGateway//releases/latest/download/dtuGateway_release_1.6.0_localDev.bin" | ||
} |
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.