1111from adafruit_display_text .Label import Label
1212
1313# Type in time to get up each day of the week
14- input_wake_up_time = ""
1514up_time_monday = "6:30A"
1615up_time_tuesday = "6:30A"
1716up_time_wednesday = "6:30A"
@@ -97,7 +96,6 @@ def subtract30min(time_before):
9796 hours_before = int (hours_before )
9897 if minutes_before >= 30 :
9998 minutes_after = minutes_before - 30
100- # display the time in a nice big font
10199 format_str = "%d:%02d"
102100 if hours_before >= 12 :
103101 hours_after = hours_before - 12
@@ -115,7 +113,7 @@ def subtract30min(time_before):
115113 hours_after = hours_before - 1
116114 format_str = "%d:%02d"
117115 if hours_before >= 12 :
118- hours_after = hours_before - 12
116+ hours_after = hours_after - 12
119117 format_str = format_str + "P"
120118 else :
121119 hours_after = hours_before
@@ -148,7 +146,6 @@ def displayTime():
148146refresh_time = None
149147
150148while True :
151-
152149 # only query the online time once per hour (and on first run)
153150 if (not refresh_time ) or (time .monotonic () - refresh_time ) > 3600 :
154151 try :
@@ -168,18 +165,18 @@ def displayTime():
168165 else :
169166 pyportal .set_backlight (0.1 )
170167 input_wake_up_time = whichDay ()
171- # sub30 = subtract30min(currentHour) # input needs to be input_wake_up_time_text
172- subtract30min ( input_wake_up_time )
168+ start_light_time = subtract30min (input_wake_up_time )
169+ print ( start_light_time )
173170 # If wake up time - 30 minutes equals current time, start the light
174- if time_str_text is input_wake_up_time :
171+ if time_str_text == start_light_time :
175172 print ("Starting wake up light" )
176173 for i in range (light_minutes - 1 ):
177174 BRIGHTNESS = BRIGHTNESS + (MAX_BRIGHTNESS / light_minutes ) # max 0.25, min 0.0
178175 strip .fill ((255 , 255 , 255 ))
179176 strip .brightness = BRIGHTNESS
180177 displayTime ()
181178 time .sleep (60 ) # 60 for once per min
182- while not pyportal .touchscreen .touch_point :
179+ while not pyportal .touchscreen .touch_point : # turn strip off
183180 displayTime ()
184181 time .sleep (1 )
185182 pass
0 commit comments