PyPortal_Quarantine_Clock: update to settings.toml

This commit is contained in:
Dan Halbert 2024-04-09 13:52:39 -04:00 committed by GitHub
parent cf6ffd5ca0
commit fc80f36526
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: MIT
import os
import time
import board
import busio
@ -13,13 +14,6 @@ from adafruit_pyportal import PyPortal
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label
try:
from secrets import secrets
except ImportError:
print("""WiFi settings are kept in secrets.py, please add them there!
the secrets dictionary must contain 'ssid' and 'password' at a minimum""")
raise
# Label colors
LABEL_DAY_COLOR = 0xFFFFFF
LABEL_TIME_COLOR = 0x2a8eba
@ -88,7 +82,7 @@ while True:
if (not refresh_time) or (time.monotonic() - refresh_time) > 3600:
try:
print("Getting new time from internet...")
pyportal.get_local_time(secrets['timezone'])
pyportal.get_local_time(os.getenv("TIMEZONE"))
refresh_time = time.monotonic()
# set the_time
the_time = time.localtime()