Commit b8c6076a authored by Matthias Uschok's avatar Matthias Uschok

Fix next run-/first run-calculation AGAIN

parent cf2eec5c
......@@ -214,5 +214,7 @@ class AutomationThermostats(appapi.AppDaemon):
return todays_schedule[todays_most_recent_time]
def calc_next_date(self, scheduled_weekday: weekday, today: date):
date_difference = ((scheduled_weekday.value + today.weekday() + 1) % 7)
return today + timedelta(days=date_difference)
\ No newline at end of file
days_ahead = scheduled_weekday.value - today.weekday()
if days_ahead < 0:
days_ahead += 7
return today + timedelta(days=days_ahead)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment