Fixed NaN errors with telemetry messages

This commit is contained in:
Dionysus 2024-12-31 18:17:01 -05:00
parent b4104b9833
commit 54c0591053
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE

View File

@ -292,7 +292,8 @@ class MeshtasticMQTT(object):
elif mp.decoded.portnum == portnums_pb2.TELEMETRY_APP: elif mp.decoded.portnum == portnums_pb2.TELEMETRY_APP:
telemetry = telemetry_pb2.Telemetry() telemetry = telemetry_pb2.Telemetry()
telemetry.ParseFromString(mp.decoded.payload) telemetry.ParseFromString(mp.decoded.payload)
json_packet['decoded']['payload'] = json.loads(MessageToJson(telemetry)) telemetry_json = json.loads(MessageToJson(telemetry))
json_packet['decoded']['payload'] = replace_nan(telemetry_json)
print(json.dumps(json_packet)) print(json.dumps(json_packet))
elif mp.decoded.portnum == portnums_pb2.TEXT_MESSAGE_APP: elif mp.decoded.portnum == portnums_pb2.TEXT_MESSAGE_APP: