fix: 24hr restart schedule enchanced.
Step 0: Pause polling Step 1: Stop measurement → wait 10s Step 2: Disable FTP → wait 10s Step 3: Enable FTP → wait 10s Step 4: Download data Step 5: Wait 30s for device to settle Step 6: Start new measurement Step 7: Re-enable polling
This commit is contained in:
@@ -657,8 +657,9 @@ async def stop_cycle(unit_id: str, payload: StopCyclePayload = None, db: Session
|
|||||||
return {"status": "ok", "unit_id": unit_id, **result}
|
return {"status": "ok", "unit_id": unit_id, **result}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Stop cycle failed for {unit_id}: {e}")
|
error_msg = str(e) if str(e) else f"{type(e).__name__}: No details available"
|
||||||
raise HTTPException(status_code=502, detail=str(e))
|
logger.error(f"Stop cycle failed for {unit_id}: {error_msg}")
|
||||||
|
raise HTTPException(status_code=502, detail=error_msg)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/{unit_id}/store")
|
@router.post("/{unit_id}/store")
|
||||||
|
|||||||
@@ -1381,8 +1381,13 @@ class NL43Client:
|
|||||||
result["stopped"] = True
|
result["stopped"] = True
|
||||||
logger.info(f"[STOP-CYCLE] Measurement stopped")
|
logger.info(f"[STOP-CYCLE] Measurement stopped")
|
||||||
|
|
||||||
# Step 2: Enable FTP
|
# Step 2: Reset FTP (disable then enable) to clear any stale state
|
||||||
logger.info(f"[STOP-CYCLE] Step 2: Enabling FTP")
|
logger.info(f"[STOP-CYCLE] Step 2: Resetting FTP (disable then enable)")
|
||||||
|
try:
|
||||||
|
await self.disable_ftp()
|
||||||
|
logger.info(f"[STOP-CYCLE] FTP disabled")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"[STOP-CYCLE] FTP disable failed (may already be off): {e}")
|
||||||
await self.enable_ftp()
|
await self.enable_ftp()
|
||||||
result["ftp_enabled"] = True
|
result["ftp_enabled"] = True
|
||||||
logger.info(f"[STOP-CYCLE] FTP enabled")
|
logger.info(f"[STOP-CYCLE] FTP enabled")
|
||||||
|
|||||||
Reference in New Issue
Block a user