From 7313370351ed28044289460162f1c686fce037f4 Mon Sep 17 00:00:00 2001 From: Smittix Date: Sun, 8 Feb 2026 13:14:27 +0000 Subject: [PATCH] Add missing /sensor/status and /tscm/status endpoints agents.js syncLocalModeStates() expects these endpoints to check whether each mode is running locally. Both were missing, causing 404 errors on mode switch. Co-Authored-By: Claude Opus 4.6 --- routes/sensor.py | 11 ++++++++++- routes/tscm.py | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/routes/sensor.py b/routes/sensor.py index a60210c..e2110fb 100644 --- a/routes/sensor.py +++ b/routes/sensor.py @@ -95,6 +95,14 @@ def stream_sensor_output(process: subprocess.Popen[bytes]) -> None: sensor_active_device = None +@sensor_bp.route('/sensor/status') +def sensor_status() -> Response: + """Check if sensor decoder is currently running.""" + with app_module.sensor_lock: + running = app_module.sensor_process is not None and app_module.sensor_process.poll() is None + return jsonify({'running': running}) + + @sensor_bp.route('/start_sensor', methods=['POST']) def start_sensor() -> Response: global sensor_active_device @@ -174,7 +182,8 @@ def start_sensor() -> Response: logger.info(f"Running: {full_cmd}") # Add signal level metadata so the frontend scope can display RSSI/SNR - cmd.extend(['-M', 'level']) + # Disable stats reporting to suppress "row count limit 50 reached" warnings + cmd.extend(['-M', 'level', '-M', 'stats:0']) try: app_module.sensor_process = subprocess.Popen( diff --git a/routes/tscm.py b/routes/tscm.py index 5a3d31d..e110495 100644 --- a/routes/tscm.py +++ b/routes/tscm.py @@ -551,6 +551,12 @@ def _start_sweep_internal( } +@tscm_bp.route('/status') +def tscm_status(): + """Check if any TSCM operation is currently running.""" + return jsonify({'running': _sweep_running}) + + @tscm_bp.route('/sweep/start', methods=['POST']) def start_sweep(): """Start a TSCM sweep."""