You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my application call this funtion every day at 00:01 to update the dusk-dawn data:
def init_light_schedule():
city = LocationInfo("Tromsø", "Norway", "Europe/Tromsø", 69.66, 18.82)
s = sun(city.observer) # , s=datetime.date(2021, 2, 18))
dawn = (s['dawn'] + datetime.timedelta(hours=1)) # negative hours gives earlier "off"
dusk = (s['dusk'] + datetime.timedelta(hours=1)) # positive hours postpone "on"
dawn = dawn.replace(tzinfo=None) # remove timezone info
dusk = dusk.replace(tzinfo=None)
now = datetime.datetime.now()
# for testing now = datetime.datetime(2021, 2, 17, 2, 00)
print(time.strftime('%H:%M:%S'), ', light schedule updated')
print('dawn: ', dawn)
print('dusk: ', dusk)
but the output does not show new data, it is displaying the data of the first day of the script run:
21:37:08 , light schedule updated <<<<< initial run (manual start)
dawn: 2021-03-01 06:08:20.148169
dusk: 2021-03-01 17:47:39.511878
00:01:00 , light schedule updated <<<< the function was executed on schedule, produced the same time(and date)
dawn: 2021-03-01 06:08:20.148169
dusk: 2021-03-01 17:47:39.511878
The text was updated successfully, but these errors were encountered:
my application call this funtion every day at 00:01 to update the dusk-dawn data:
but the output does not show new data, it is displaying the data of the first day of the script run:
21:37:08 , light schedule updated <<<<< initial run (manual start)
dawn: 2021-03-01 06:08:20.148169
dusk: 2021-03-01 17:47:39.511878
00:01:00 , light schedule updated <<<< the function was executed on schedule, produced the same time(and date)
dawn: 2021-03-01 06:08:20.148169
dusk: 2021-03-01 17:47:39.511878
The text was updated successfully, but these errors were encountered: