Fix jwt-token
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user