Update install.sh

This commit is contained in:
RaspbianProyect by HP3ICC 2023-06-07 21:46:32 +00:00
parent 2faf49ff1b
commit 2f74540f7b
1 changed files with 11 additions and 4 deletions

View File

@ -67,7 +67,7 @@ serverPort = 14580 # aprs server port
every = 10 # Time in minutes to send beacon
api_key = "APIKEY" # Your OpenWeatherMap API key (abcd12345567890)
map_id = "MAPID" # Your OpenWeatherMap Map ID (123456)
lang = "es" # Language weather beacon ('es' for Spanish, 'en' English 'it' Italian )
@ -82,7 +82,7 @@ mid = f"{map_id}"
while True:
try:
# Get weather data from OpenWeatherMap API
url = f"https://api.openweathermap.org/data/2.5/weather?id={mid}&lang=es&units=imperial&appid={mlogin}"
url = f"https://api.openweathermap.org/data/2.5/weather?id={mid}&lang={lang}&units=imperial&appid={mlogin}"
response = requests.get(url)
data = response.json()
@ -101,7 +101,10 @@ while True:
rain = str(rain).zfill(3)
humidity = data["main"]["humidity"]
weather_description = data["weather"][0]["description"]
clima = f" / Clima en {name}: " if name else " / Clima: "
if lang == "es":
clima = f" / Clima en {name}: " if name else " / Clima: "
else:
clima = f" / Weather in {name} " if name else " / Clima: "
weather_data = f"{deg}/{wind}g{gust}t{temperature}r{rain}p000h{humidity}b{presure}0{comment}{clima}{weather_description}"
else:
name = ""
@ -113,7 +116,10 @@ while True:
rain = "000"
humidity = "00"
weather_description = ""
clima = " / Clima: "
if lang == "es":
clima = " / Clima: "
else:
clima = " / Weather: "
weather_data = "000/000g000t032r000p000h..b00000WX1 Data Weather not found"
current_time_utc = datetime.utcnow().strftime("%d%H%M")
packet = f"{address}@{current_time_utc}z{latitude}{simbol_primary}{longitude}{simbol_secundary}{weather_data}"
@ -130,6 +136,7 @@ while True:
time.sleep(every * 60)
EOF
###########################
sudo cat > /bin/menu-py-wx <<- "EOF"