Toggle Navigation
Hatchery
Eggs
CZ_weather
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import urequests import rgb import system import wifi import time apikey = 'dd9a4f449b' location = 'Veghel' from default_icons import animation_connecting_wifi, icon_no_wifi if not wifi.status(): data, size, frames = animation_connecting_wifi rgb.clear() rgb.framerate(3) rgb.gif(data, (12, 0), size, frames) wifi.connect() if wifi.wait(): rgb.clear() rgb.framerate(20) else: print('No wifi') rgb.clear() rgb.framerate(20) data, frames = icon_no_wifi rgb.image(data, (12, 0), (8,8)) time.sleep(3) rgb.clear() if not wifi.status(): print("Error connecting to wifi") system.reboot() while True: result = urequests.get('https://weerlive.nl/api/json-data-10min.php?key=' + (apikey) + '&locatie=' + (location)) parsed_object = result.json()['liveweer'][0] plaatsnaam = parsed_object['plaats'] huidigetemp = parsed_object['temp'] samenvatting = parsed_object['samenv'] disp_string = "%s %sC %s" % (plaatsnaam, huidigetemp, samenvatting) print(disp_string) rgb.framerate(10) rgb.clear() rgb.scrolltext((disp_string), (0,0,255)) fifteen_minutes = 15 * 60 time.sleep(fifteen_minutes) # Sleep 15 minutes before requesting new update