Update install.sh
This commit is contained in:
parent
2faf49ff1b
commit
2f74540f7b
15
install.sh
15
install.sh
|
|
@ -67,7 +67,7 @@ serverPort = 14580 # aprs server port
|
||||||
every = 10 # Time in minutes to send beacon
|
every = 10 # Time in minutes to send beacon
|
||||||
api_key = "APIKEY" # Your OpenWeatherMap API key (abcd12345567890)
|
api_key = "APIKEY" # Your OpenWeatherMap API key (abcd12345567890)
|
||||||
map_id = "MAPID" # Your OpenWeatherMap Map ID (123456)
|
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:
|
while True:
|
||||||
try:
|
try:
|
||||||
# Get weather data from OpenWeatherMap API
|
# 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)
|
response = requests.get(url)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
|
|
@ -101,7 +101,10 @@ while True:
|
||||||
rain = str(rain).zfill(3)
|
rain = str(rain).zfill(3)
|
||||||
humidity = data["main"]["humidity"]
|
humidity = data["main"]["humidity"]
|
||||||
weather_description = data["weather"][0]["description"]
|
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}"
|
weather_data = f"{deg}/{wind}g{gust}t{temperature}r{rain}p000h{humidity}b{presure}0{comment}{clima}{weather_description}"
|
||||||
else:
|
else:
|
||||||
name = ""
|
name = ""
|
||||||
|
|
@ -113,7 +116,10 @@ while True:
|
||||||
rain = "000"
|
rain = "000"
|
||||||
humidity = "00"
|
humidity = "00"
|
||||||
weather_description = ""
|
weather_description = ""
|
||||||
clima = " / Clima: "
|
if lang == "es":
|
||||||
|
clima = " / Clima: "
|
||||||
|
else:
|
||||||
|
clima = " / Weather: "
|
||||||
weather_data = "000/000g000t032r000p000h..b00000WX1 Data Weather not found"
|
weather_data = "000/000g000t032r000p000h..b00000WX1 Data Weather not found"
|
||||||
current_time_utc = datetime.utcnow().strftime("%d%H%M")
|
current_time_utc = datetime.utcnow().strftime("%d%H%M")
|
||||||
packet = f"{address}@{current_time_utc}z{latitude}{simbol_primary}{longitude}{simbol_secundary}{weather_data}"
|
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)
|
time.sleep(every * 60)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
###########################
|
###########################
|
||||||
sudo cat > /bin/menu-py-wx <<- "EOF"
|
sudo cat > /bin/menu-py-wx <<- "EOF"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue