kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Merge pull request #599 from pimoroni/helgibbons-patch-1
Use http instead of https to avoid memory errorspull/602/head
commit
a9d9c1089e
|
@ -25,7 +25,7 @@ LAT = 53.38609085276884
|
||||||
LNG = -1.4239983439328177
|
LNG = -1.4239983439328177
|
||||||
TIMEZONE = "auto" # determines time zone from lat/long
|
TIMEZONE = "auto" # determines time zone from lat/long
|
||||||
|
|
||||||
URL = "https://api.open-meteo.com/v1/forecast?latitude=" + str(LAT) + "&longitude=" + str(LNG) + "¤t_weather=true&timezone=" + TIMEZONE
|
URL = "http://api.open-meteo.com/v1/forecast?latitude=" + str(LAT) + "&longitude=" + str(LNG) + "¤t_weather=true&timezone=" + TIMEZONE
|
||||||
UPDATE_INTERVAL = 900 # refresh interval in secs. Be nice to free APIs!
|
UPDATE_INTERVAL = 900 # refresh interval in secs. Be nice to free APIs!
|
||||||
|
|
||||||
# Weather codes from https://open-meteo.com/en/docs#:~:text=WMO%20Weather%20interpretation%20codes%20(WW)
|
# Weather codes from https://open-meteo.com/en/docs#:~:text=WMO%20Weather%20interpretation%20codes%20(WW)
|
||||||
|
@ -88,7 +88,6 @@ def get_data():
|
||||||
# open the json data
|
# open the json data
|
||||||
j = r.json()
|
j = r.json()
|
||||||
print("Data obtained!")
|
print("Data obtained!")
|
||||||
r.close()
|
|
||||||
|
|
||||||
# parse relevant data from JSON
|
# parse relevant data from JSON
|
||||||
current = j["current_weather"]
|
current = j["current_weather"]
|
||||||
|
@ -101,6 +100,8 @@ Conditions = {WEATHERCODES[weathercode]}
|
||||||
Last Open-Meteo update: {datetime_arr[0]}, {datetime_arr[1]}
|
Last Open-Meteo update: {datetime_arr[0]}, {datetime_arr[1]}
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
r.close()
|
||||||
|
|
||||||
# flash the onboard LED after getting data
|
# flash the onboard LED after getting data
|
||||||
pico_led.value(True)
|
pico_led.value(True)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
Ładowanie…
Reference in New Issue