Skip to content

Commit b0564b3

Browse files
author
Vaclav
committed
#313 error in loading group schedule
1 parent b8497b8 commit b0564b3

File tree

1 file changed

+3
-3
lines changed
  • custom_components/garbage_collection

1 file changed

+3
-3
lines changed

custom_components/garbage_collection/sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ async def _async_find_candidate_date(self, day1: date):
487487
for entity_id in self._entities:
488488
entity = self.hass.data[DOMAIN][SENSOR_PLATFORM][entity_id]
489489
d = await entity.async_next_date(day1)
490-
if candidate_date is None or d < candidate_date:
490+
if d is not None and (candidate_date is None or d < candidate_date):
491491
candidate_date = d
492492
except KeyError:
493493
raise ValueError
@@ -641,8 +641,8 @@ async def _async_find_next_date(self, first_date: date):
641641
days=self._offset
642642
)
643643
next_date = await self._async_skip_holidays(next_date)
644-
except ValueError:
645-
raise
644+
except (TypeError, ValueError):
645+
return None
646646
# Check if the date is within the range
647647
new_date = self.move_to_range(next_date)
648648
if new_date != next_date:

0 commit comments

Comments
 (0)