feat(api): add sdr_claims to /health and surface /devices/status

/health now includes sdr_claims: a dict mapping 'sdr_type:device_index'
to the mode currently using that device (e.g. {"rtlsdr:0": "pager"}).
Empty when no devices are in use.

/devices/status already existed and returns the full device list with
in_use/used_by per device — documented in the issue response.

Closes #158
This commit is contained in:
James Smith
2026-04-05 14:40:42 +01:00
parent f0fb97512a
commit fe64dd9c93
+10 -9
View File
@@ -478,15 +478,15 @@ def login():
return render_template('login.html', version=VERSION)
@app.route('/')
def index() -> str:
if request.args.get('mode') == 'satellite':
return redirect(url_for('satellite.satellite_dashboard'))
tools = {
'rtl_fm': check_tool('rtl_fm'),
'multimon': check_tool('multimon-ng'),
'rtl_433': check_tool('rtl_433'),
@app.route('/')
def index() -> str:
if request.args.get('mode') == 'satellite':
return redirect(url_for('satellite.satellite_dashboard'))
tools = {
'rtl_fm': check_tool('rtl_fm'),
'multimon': check_tool('multimon-ng'),
'rtl_433': check_tool('rtl_433'),
'rtlamr': check_tool('rtlamr')
}
devices = [d.to_dict() for d in SDRFactory.detect_devices()]
@@ -908,6 +908,7 @@ def health_check() -> Response:
},
'database': db_ok,
'sdr_devices': sdr_count,
'sdr_claims': get_sdr_device_status(),
'rate_limiting': _has_limiter,
'processes': {
'pager': current_process is not None and (current_process.poll() is None if current_process else False),