diff --git a/app.py b/app.py index e5e130f..c039e67 100644 --- a/app.py +++ b/app.py @@ -302,22 +302,33 @@ def on_message(client, userdata, msg): except Exception as e: logger.error(f"Error parsing DMRGateway for {cid}: {e}") - # --- MMDVMHOST INFO MANAGEMENT (FREQUENZE) --- elif len(parts) >= 4 and parts[0] == 'data' and parts[2].lower() == 'mmdvmhost' and parts[3].lower() == 'info': try: cid = parts[1].lower() data = json.loads(payload) + + # Estrazione dati tx = data.get("TXFrequency", "0") rx = data.get("RXFrequency", "0") + lat = data.get("Latitude", "0.0") + lon = data.get("Longitude", "0.0") + loc = data.get("Location", "Sconosciuta") - # Funzione per formattare gli Hz in MHz (es. 430500000 -> 430.500 MHz) + # Funzione per formattare gli Hz in MHz def format_freq(f): if str(f).isdigit() and int(f) > 0: return f"{int(f)/1000000:.3f} MHz" return str(f) - node_info[cid] = {"tx": format_freq(tx), "rx": format_freq(rx)} - socketio.emit('dati_aggiornati') # <--- Aggiorna la UI in tempo reale + # Salvataggio nel dizionario globale + node_info[cid] = { + "tx": format_freq(tx), + "rx": format_freq(rx), + "lat": lat, + "lon": lon, + "loc": loc + } + socketio.emit('dati_aggiornati') except Exception as e: logger.error(f"Error parsing MMDVMHost info for {cid}: {e}") diff --git a/templates/index.html b/templates/index.html index a734a8a..3fe8217 100644 --- a/templates/index.html +++ b/templates/index.html @@ -52,6 +52,10 @@ .freq-tx { color: #f87171; } /* Rosso per la TX */ .freq-rx { color: #4ade80; } /* Verde per la RX */ + /* Metadati Nodo (Location, Coordinate) */ + .node-meta { font-size: 0.75rem; color: #8b949e; text-align: center; margin-bottom: 15px; line-height: 1.4; } + .node-meta-item { display: block; } + /* Display Stato */ .status-display { text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 700; padding: 8px; border-radius: 3px; background: #010409; border: 1px solid var(--border-color); margin-bottom: 15px; color: var(--text-muted); } .card.online .status-display { color: var(--success); border-color: rgba(46, 160, 67, 0.4); } @@ -592,11 +596,14 @@ ${c.name} ID: ${c.id.toUpperCase()} - +