From 62484e3c528140072f3402988e7850a5d9adb834 Mon Sep 17 00:00:00 2001 From: marcel Date: Thu, 4 Jan 2024 12:02:24 +0100 Subject: [PATCH] Fixed: can now receive messages after reconnect to MQTT broker --- CHANGELOG.md | 9 ++++++--- aprs-mqtt-bridge.py | 12 ++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9a27b8..179f473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,13 @@ All notable changes to this project will be documented in this file. Security : in case of vulnerabilities. ## [1.0.0] - 2023-01-13 -First working version. +- First working version. ## [1.0.1] - 2023-01-14 -Changed: aprs_status (published on the MQTT broker) now returns actual state of transmision (sending, retrying, send or failed) instead if just 'ready' and 'busy'. +- Changed: aprs_status (published on the MQTT broker) now returns actual state of transmision (sending, retrying, send or failed) instead if just 'ready' and 'busy'. ## [1.1.0] - 2023-07-08 -Added: APRS nodes can now be polled to get there actual status. An extra section in the YAML configuration file is added for this functionality. +- Added: APRS nodes can now be polled to get there actual status. An extra section in the YAML configuration file is added for this functionality. + +## [1.1.1] - 2024-01-04 +- Fixed: after reconnect to MQTT broker messages from broker were not received. diff --git a/aprs-mqtt-bridge.py b/aprs-mqtt-bridge.py index 4eb192b..05855b0 100755 --- a/aprs-mqtt-bridge.py +++ b/aprs-mqtt-bridge.py @@ -164,7 +164,14 @@ def connect_mqtt(): else: print("Failed to connect, return code %d\n", rc) # Set Connecting Client ID - client = mqtt_client.Client(mqtt.client_id) + # After reconnect messages from the MQTT broker where not received. + # clean_session: a boolean that determines the client type. + # If True, the broker will remove all information about this client + # when it disconnects. If False, the client is a durable client and + # subscription information and queued messages will be retained when + # the client disconnects. + # client = mqtt_client.Client(mqtt.client_id) + client = mqtt_client.Client(mqtt.client_id, clean_session=False) #client.username_pw_set(username, password) client.on_connect = on_connect client.connect(mqtt.broker, mqtt.port) @@ -490,6 +497,7 @@ def run(): if __name__ == '__main__': - #sys.stdout = sys.stderr = open('debug.log', 'w') + sys.stdout = sys.stderr = open('/home/marcel/aprs-mqtt-bridge_debug.log', 'w') + run()