So the automation below has been working for a long time:
def initialize(self):
time = datetime.time(19, 30, 0)
self.run_daily(self.first_notification, time, constrain_days="sun,mon,tue,wed,thu")
After the update to 4, this doesn’t work. So I did some testing and it seems to be 1 day ahead; as the below works :
def initialize(self):
time_to_run = datetime.time(21, 51, 0)
self.run_daily(self.func, time_to_run, constrain_days="fri") # tomorrow
def func(self, kwargs):
self.log(datetime.datetime.now())
self.log(datetime.datetime.now().today().weekday())
# returned: 2020-01-23 21:51:00.049272 INFO testing: 2020-01-23 21:51:00.046546
# 2020-01-23 21:51:00.061440 INFO testing: 3
But this, which is the actual day, doesn’t work:
def initialize(self):
time_to_run = datetime.time(21, 51, 0)
self.run_daily(self.func, time_to_run, constrain_days="thu") # the actual day
def func(self, kwargs):
self.log(datetime.datetime.now())
self.log(datetime.datetime.now().today().weekday())
# returned: nothing
So not sure what is going on, what am I missing or is this a bug?
Edit: Additional info to help track this down. I tested this again the next day in the morning (10am) and all worked as expected; testing again just now (8:30pm) and it is all 1 day ahead as shown above. So its probably after 12 noon when it makes the change…