add network information display showing hostname and IP address

This commit is contained in:
2026-02-10 16:51:22 +01:00
parent 7c2f0bf0cb
commit f2382470d8

View File

@@ -1699,6 +1699,20 @@ with st.expander("System control", expanded=False):
except Exception as e:
st.warning(f"Could not read temperatures: {e}")
st.subheader("Network Information")
try:
import subprocess, socket
device_hostname = socket.gethostname()
result = subprocess.run(["hostname", "-I"], capture_output=True, text=True, timeout=2)
ips = [ip for ip in result.stdout.strip().split() if not ip.startswith('127.') and ':' not in ip]
st.write(f"Hostname: **{device_hostname}**")
if ips:
st.write(f"IP Address: **{ips[0]}**")
else:
st.warning("No valid IP address found.")
except Exception as e:
st.warning(f"Could not determine network info: {e}")
st.subheader("CA Certificate")
st.caption("Download the CA certificate to trust this device's HTTPS connection.")
try: