Fix jwt-token
This commit is contained in:
@@ -63,13 +63,16 @@ class DeviceProbeSimulator:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# ONLY send the exact format requested: {type:"heartbeat", key:"device_id"}
|
||||||
payload = {
|
payload = {
|
||||||
'type': 'heartbeat',
|
'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(
|
response = self.session.post(
|
||||||
f"{self.api_base_url}/devices/heartbeat",
|
f"{self.api_base_url}/heartbeat", # Changed to correct endpoint
|
||||||
json=payload,
|
json=payload,
|
||||||
timeout=10
|
timeout=10
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -267,14 +267,7 @@ def send_heartbeat(device_id):
|
|||||||
|
|
||||||
heartbeat_data = {
|
heartbeat_data = {
|
||||||
"type": "heartbeat",
|
"type": "heartbeat",
|
||||||
"key": f"device_{device_id}",
|
"key": str(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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Debug output for heartbeat
|
# Debug output for heartbeat
|
||||||
|
|||||||
Reference in New Issue
Block a user