diff --git a/drone_simulator.py b/drone_simulator.py index 0862a17..ab12b84 100644 --- a/drone_simulator.py +++ b/drone_simulator.py @@ -252,6 +252,10 @@ class SwedishDroneSimulator: payload = { "type": "heartbeat", "key": str(device.device_id), # Use device ID directly as key + "device_id": device.device_id, # Also include explicit device_id + "geo_lat": device.lat, # Include device coordinates + "geo_lon": device.lon, + "location_description": device.location, # Include location name "battery_level": device.battery_level, "signal_strength": device.signal_strength, "temperature": device.temperature diff --git a/server/routes/detectors.js b/server/routes/detectors.js index 8a6b6d5..2fbb6cd 100644 --- a/server/routes/detectors.js +++ b/server/routes/detectors.js @@ -46,6 +46,9 @@ const detectorSchema = Joi.alternatives().try( key: Joi.string().required(), // Optional heartbeat fields device_id: Joi.number().integer().optional(), + geo_lat: Joi.number().min(-90).max(90).optional(), + geo_lon: Joi.number().min(-180).max(180).optional(), + location_description: Joi.string().optional(), signal_strength: Joi.number().integer().optional(), battery_level: Joi.number().integer().min(0).max(100).optional(), temperature: Joi.number().optional(),