add location

This commit is contained in:
Logan Cusano
2025-12-28 17:39:15 -05:00
parent a7d8e86e2d
commit 642e8c8da4
2 changed files with 9 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ app.include_router(create_op25_router(), prefix="/op25")
# Configuration
NODE_ID = os.getenv("NODE_ID", "standalone-node")
MQTT_BROKER = os.getenv("MQTT_BROKER", None)
NODE_LAT = os.getenv("NODE_LAT")
NODE_LONG = os.getenv("NODE_LONG")
# Global flag to track MQTT connection state
MQTT_CONNECTED = False
@@ -155,7 +157,11 @@ async def mqtt_lifecycle_manager():
"is_listening": op25_status.get("is_running", False),
"active_system": op25_status.get("active_system"),
# Only scan library if needed, otherwise it's heavy I/O
"available_systems": scan_local_library()
"available_systems": scan_local_library(),
"location": {
"lat": float(NODE_LAT) if NODE_LAT else None,
"long": float(NODE_LONG) if NODE_LONG else None
}
}
client.publish(f"nodes/{NODE_ID}/checkin", json.dumps(payload), retain=True)