Skip to content

Commit

Permalink
always upload telem as it comes
Browse files Browse the repository at this point in the history
  • Loading branch information
EricAndrechek committed Apr 11, 2024
1 parent 9ee3758 commit 8dd5c88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tracking-dashboard/backend/mqtt-syncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ def on_message(client, userdata, message):
else:
# add key and payload to message_building
message_building[id][key] = payload
# if telemetry data, send to mqtt
nonTelemKeys = ['name', 'ssid', 'sym', 'lat', 'lon', 'alt', 'cse', 'spd', 'hh', 'mm', 'ss', 'YY', 'MM', 'DD']
if key not in nonTelemKeys:
# check if value is the same as last value
if id in old_messages:
if key in old_messages[id] and payload == old_messages[id][key]:
return
# send telemetry data to mqtt
topic = "TELEMETRY/" + message_building[id]['name'] + "-" + str(message_building[id]['ssid'])
client.publish(topic + "/" + key, json.dumps(payload), retain=True, qos=0)
old_messages[id][key] = payload
else:
print("Unknown topic: ", topic)

Expand Down

0 comments on commit 8dd5c88

Please sign in to comment.