Fixed: can now receive messages after reconnect to MQTT broker

master
marcel 5 months ago
parent 844b23c20c
commit 62484e3c52
  1. 9
      CHANGELOG.md
  2. 12
      aprs-mqtt-bridge.py

@ -10,10 +10,13 @@ All notable changes to this project will be documented in this file.
Security : in case of vulnerabilities. Security : in case of vulnerabilities.
## [1.0.0] - 2023-01-13 ## [1.0.0] - 2023-01-13
First working version. - First working version.
## [1.0.1] - 2023-01-14 ## [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 ## [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.

@ -164,7 +164,14 @@ def connect_mqtt():
else: else:
print("Failed to connect, return code %d\n", rc) print("Failed to connect, return code %d\n", rc)
# Set Connecting Client ID # 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.username_pw_set(username, password)
client.on_connect = on_connect client.on_connect = on_connect
client.connect(mqtt.broker, mqtt.port) client.connect(mqtt.broker, mqtt.port)
@ -490,6 +497,7 @@ def run():
if __name__ == '__main__': 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() run()

Loading…
Cancel
Save