File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ def subtract30min(day): # subtract 30 min
190190refresh_time = None
191191
192192while True :
193+ time_now = time .localtime ()
193194 # only query the online time once per hour (and on first run)
194195 if (not refresh_time ) or (time .monotonic () - refresh_time ) > 3600 :
195196 try :
@@ -208,8 +209,9 @@ def subtract30min(day): # subtract 30 min
208209 backLight ()
209210 # start the light 30 min before wake up time
210211 start_light_time = subtract30min (wake_up_day )
211- # If wake up time - 30 minutes equals current time, start the light
212- if time_str_text == start_light_time :
212+ # If current day is wake up day and
213+ # wake up time - 30 minutes equals current time, start the light
214+ if wake_up_day == time_now [6 ] and time_str_text == start_light_time :
213215 print ("Starting wake up light" )
214216 # turn on backlight
215217 pyportal .set_backlight (backlight_on )
You can’t perform that action at this time.
0 commit comments