1 Commits

Author SHA1 Message Date
serversdwn
62fd963c07 Add: pair_devices.html template for device pairing interface
Fix:
- Polling intervals for SLMM.
-modem view now list
- device pairing much improved.
-various other tweaks through out UI.
2026-01-29 06:08:40 +00:00

View File

@@ -151,23 +151,11 @@ def emit_status_snapshot():
# --- Derive modem status from paired devices --- # --- Derive modem status from paired devices ---
# Modems don't have their own check-in system, so we inherit status # Modems don't have their own check-in system, so we inherit status
# from whatever device they're paired with (seismograph or SLM) # from whatever device they're paired with (seismograph or SLM)
# Check both directions: modem.deployed_with_unit_id OR device.deployed_with_modem_id
for unit_id, unit_data in units.items(): for unit_id, unit_data in units.items():
if unit_data.get("device_type") == "modem" and not unit_data.get("retired"): if unit_data.get("device_type") == "modem" and not unit_data.get("retired"):
paired_unit_id = None
roster_unit = roster.get(unit_id) roster_unit = roster.get(unit_id)
# First, check if modem has deployed_with_unit_id set
if roster_unit and roster_unit.deployed_with_unit_id: if roster_unit and roster_unit.deployed_with_unit_id:
paired_unit_id = roster_unit.deployed_with_unit_id paired_unit_id = roster_unit.deployed_with_unit_id
else:
# Fallback: check if any device has this modem in deployed_with_modem_id
for other_id, other_roster in roster.items():
if other_roster.deployed_with_modem_id == unit_id:
paired_unit_id = other_id
break
if paired_unit_id:
paired_unit = units.get(paired_unit_id) paired_unit = units.get(paired_unit_id)
if paired_unit: if paired_unit:
# Inherit status from paired device # Inherit status from paired device