diff --git a/health_probe_simulator.py b/health_probe_simulator.py index 143a2e3..ec3b920 100644 --- a/health_probe_simulator.py +++ b/health_probe_simulator.py @@ -63,13 +63,16 @@ class DeviceProbeSimulator: return False try: + # ONLY send the exact format requested: {type:"heartbeat", key:"device_id"} payload = { 'type': 'heartbeat', - 'key': device['unique_key'] # Use the device's unique key + 'key': str(device_id) # Use device_id as the key } + print(f"📡 Sending heartbeat: {payload}") + response = self.session.post( - f"{self.api_base_url}/devices/heartbeat", + f"{self.api_base_url}/heartbeat", # Changed to correct endpoint json=payload, timeout=10 ) diff --git a/test_drone_data.py b/test_drone_data.py index 72b4c50..df468f3 100644 --- a/test_drone_data.py +++ b/test_drone_data.py @@ -267,14 +267,7 @@ def send_heartbeat(device_id): heartbeat_data = { "type": "heartbeat", - "key": f"device_{device_id}", - "device_id": device_id, - "signal_strength": random.randint(-70, -30), # Simulate signal strength - "battery_level": random.randint(70, 100), # Simulate battery level - "temperature": random.randint(20, 45), # Simulate temperature - "uptime": random.randint(3600, 86400), # Simulate uptime - "memory_usage": random.randint(30, 80), # Simulate memory usage - "firmware_version": "1.0.0" + "key": str(device_id) } # Debug output for heartbeat