diff --git a/README.md b/README.md index a69e294c..a7c9c1ae 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ A 3d-printable housing can be found here: https://www.thingiverse.com/thing:4571 ##### 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` * Update digital CNN to v7.2.1 (additional digital images trained) * Bug fixing: diff --git a/code/components/jomjol_mqtt/interface_mqtt.cpp b/code/components/jomjol_mqtt/interface_mqtt.cpp index 6c8b0102..dec910b5 100644 --- a/code/components/jomjol_mqtt/interface_mqtt.cpp +++ b/code/components/jomjol_mqtt/interface_mqtt.cpp @@ -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){ std::string _zwmessage = "connection lost"; - int _lzw = _LWTContext.length(); + int _lzw = _zwmessage.length(); esp_mqtt_client_config_t mqtt_cfg = { .uri = _mqttURI.c_str(), .client_id = _clientid.c_str(), -// .lwt_topic = _LWTContext.c_str(), - .lwt_topic = "wasserzaehler/connection", + .lwt_topic = _LWTContext.c_str(), .lwt_msg = _zwmessage.c_str(), .lwt_msg_len = _lzw, .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); esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client); esp_mqtt_client_start(client); + + MQTTPublish(_LWTContext, ""); } diff --git a/code/main/version.cpp b/code/main/version.cpp index 76c2a86c..6b6e8d43 100644 --- a/code/main/version.cpp +++ b/code/main/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="3502ac9"; +const char* GIT_REV="becb886"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2020-12-29 21:49"; \ No newline at end of file +const char* BUILD_TIME="2020-12-30 10:10"; \ No newline at end of file diff --git a/code/version.cpp b/code/version.cpp index 76c2a86c..6b6e8d43 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="3502ac9"; +const char* GIT_REV="becb886"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2020-12-29 21:49"; \ No newline at end of file +const char* BUILD_TIME="2020-12-30 10:10"; \ No newline at end of file diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index e6770df3..c48cf7ed 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 2b1cb3ee..33746767 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ