Skip to content

Commit

Permalink
Merge pull request #276 from bruxy70/development
Browse files Browse the repository at this point in the history
Fixed ready  for update check
  • Loading branch information
bruxy70 authored Jun 22, 2021
2 parents e3fe26e + 83ec5f2 commit 9e5d575
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions custom_components/garbage_collection/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async def async_load_holidays(self, today: date) -> None:
kwargs["prov"] = self._holiday_prov
if (
self._holiday_observed is not None
and type(self._holiday_observed) == bool
and type(self._holiday_observed) is bool
and not self._holiday_observed
):
kwargs["observed"] = self._holiday_observed
Expand Down Expand Up @@ -574,8 +574,14 @@ async def _async_ready_for_update(self) -> bool:
else:
try:
if self._next_date == today and (
now.time() >= self.expire_after
or self.last_collection.date() == today
(
type(self.expire_after) is time
and now.time() >= self.expire_after
)
or (
type(self.last_collection) is datetime
and self.last_collection.date() == today
)
):
ready_for_update = True
except (AttributeError, TypeError):
Expand Down

0 comments on commit 9e5d575

Please sign in to comment.