From 0d564af88719b244d790f9d149a8b1232431228b Mon Sep 17 00:00:00 2001 From: rgc99 Date: Tue, 23 Mar 2021 06:24:43 +0000 Subject: [PATCH] Fix race condition --- .../irrigation_unlimited/irrigation_unlimited.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/irrigation_unlimited/irrigation_unlimited.py b/custom_components/irrigation_unlimited/irrigation_unlimited.py index 1aafcdd..23f5ee3 100644 --- a/custom_components/irrigation_unlimited/irrigation_unlimited.py +++ b/custom_components/irrigation_unlimited/irrigation_unlimited.py @@ -694,7 +694,7 @@ def merge( # the finish time of the last entry. run = self.find_last_by_id(schedule.id) if run is not None: - next_time = run.end_time + next_time = run.end_time + granularity_time() else: next_time = time if next_time < last_date: @@ -708,7 +708,7 @@ def merge( if len(dates) > 0: ns = min(dates) - if ns < last_date: + if ns != end_of_time and ns < last_date: # There might be overlapping schedules. Add them all. for i, d in enumerate(dates): if d == ns: