Skip to content

Commit 1b3aeeb

Browse files
committed
refactor: use Streamlit secrets for Raspberry Pi IP address retrieval
1 parent cefe01a commit 1b3aeeb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/cli_components/ifconfig.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from rich import print as rprint
33
import socket
44
import streamlit as st
5-
from pathlib import Path
65
from threading import Lock
76

87

@@ -78,12 +77,8 @@ def find_pi_address():
7877
"""Try use direct IP connection to find the Raspberry Pi's address"""
7978
try:
8079
rprint("[yellow]Trying direct IP connection...[/yellow]")
81-
# Read IP from file instead of hardcoding
82-
ip_file = Path("/var/tmp/wx/last_ip.txt")
83-
if ip_file.exists():
84-
address = ip_file.read_text().strip()
85-
else:
86-
return None
80+
# Get IP from Streamlit secrets instead of file
81+
address = st.secrets["weatherstation"]["ip"]
8782

8883
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8984
sock.settimeout(2)

0 commit comments

Comments
 (0)