mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 20:46:52 +03:00
MQTT: LWT
This commit is contained in:
@@ -27,6 +27,10 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571
|
|||||||
|
|
||||||
##### Rolling - (2020-12-29)
|
##### Rolling - (2020-12-29)
|
||||||
|
|
||||||
|
* MQTT: LWT (Last Will Testament) implemented: "connection lost" is written to the error topic in case of connection lost (`TopicError`)
|
||||||
|
|
||||||
|
2020-12-29
|
||||||
|
|
||||||
* Parameter `TimerServer` added to `config.ini`
|
* Parameter `TimerServer` added to `config.ini`
|
||||||
* Update digital CNN to v7.2.1 (additional digital images trained)
|
* Update digital CNN to v7.2.1 (additional digital images trained)
|
||||||
* Bug fixing:
|
* Bug fixing:
|
||||||
|
|||||||
@@ -67,13 +67,12 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
|||||||
void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password, std::string _LWTContext, int _keepalive){
|
void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password, std::string _LWTContext, int _keepalive){
|
||||||
std::string _zwmessage = "connection lost";
|
std::string _zwmessage = "connection lost";
|
||||||
|
|
||||||
int _lzw = _LWTContext.length();
|
int _lzw = _zwmessage.length();
|
||||||
|
|
||||||
esp_mqtt_client_config_t mqtt_cfg = {
|
esp_mqtt_client_config_t mqtt_cfg = {
|
||||||
.uri = _mqttURI.c_str(),
|
.uri = _mqttURI.c_str(),
|
||||||
.client_id = _clientid.c_str(),
|
.client_id = _clientid.c_str(),
|
||||||
// .lwt_topic = _LWTContext.c_str(),
|
.lwt_topic = _LWTContext.c_str(),
|
||||||
.lwt_topic = "wasserzaehler/connection",
|
|
||||||
.lwt_msg = _zwmessage.c_str(),
|
.lwt_msg = _zwmessage.c_str(),
|
||||||
.lwt_msg_len = _lzw,
|
.lwt_msg_len = _lzw,
|
||||||
.keepalive = _keepalive
|
.keepalive = _keepalive
|
||||||
@@ -88,4 +87,6 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
|
|||||||
client = esp_mqtt_client_init(&mqtt_cfg);
|
client = esp_mqtt_client_init(&mqtt_cfg);
|
||||||
esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
|
esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
|
||||||
esp_mqtt_client_start(client);
|
esp_mqtt_client_start(client);
|
||||||
|
|
||||||
|
MQTTPublish(_LWTContext, "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="3502ac9";
|
const char* GIT_REV="becb886";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2020-12-29 21:49";
|
const char* BUILD_TIME="2020-12-30 10:10";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="3502ac9";
|
const char* GIT_REV="becb886";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="rolling";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2020-12-29 21:49";
|
const char* BUILD_TIME="2020-12-30 10:10";
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user