Skip to content

Commit d13a707

Browse files
committed
GPS time conflicts with the InfluxDB time field
1 parent eee92d0 commit d13a707

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

bridge/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class NodeInfoPoint(TelemetryPoint):
6363
class PositionPoint(TelemetryPoint):
6464
latitude_i: int
6565
longitude_i: int
66-
time: Optional[str] = None
66+
gps_time: Optional[str] = None
6767
precision_bits: Optional[int] = None
6868
altitude: Optional[int] = None
6969
PDOP: Optional[int] = None

bridge/mesh.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ def data(self) -> Optional[Union[NodeInfoPoint, PositionPoint, SensorTelemetryPo
191191
return NodeInfoPoint(**point_data)
192192
elif self.portnum == PortNum.POSITION_APP:
193193
if ("latitude_i" in self.payload_as_dict and "longitude_i" in self.payload_as_dict) or self.force_decode:
194+
# The GPS time field ends up being used by InfluxDB as the record time so we need to rename it
195+
if point_data.get("time"):
196+
point_data["gps_time"] = point_data.pop("time", None)
197+
194198
return PositionPoint(**point_data)
195199
else:
196200
logger.bind(**self.payload_as_dict).debug("Latitude and longitude not found in payload")

0 commit comments

Comments
 (0)