diff --git a/custom_components/yasno_outages/api.py b/custom_components/yasno_outages/api.py index 6775a75..9b68b7d 100644 --- a/custom_components/yasno_outages/api.py +++ b/custom_components/yasno_outages/api.py @@ -75,7 +75,7 @@ def get_group_schedule(self, city: str, group: str) -> list: def get_current_event(self, at: datetime.datetime) -> dict | None: """Get the current event.""" - for event in self.get_events(at, at + datetime.timedelta(hours=1)): + for event in self.get_events(at, at + datetime.timedelta(days=1)): if event["start"] <= at < event["end"]: return event return None diff --git a/custom_components/yasno_outages/coordinator.py b/custom_components/yasno_outages/coordinator.py index 4b8fdbf..51f51a9 100644 --- a/custom_components/yasno_outages/coordinator.py +++ b/custom_components/yasno_outages/coordinator.py @@ -140,11 +140,9 @@ def next_connectivity(self) -> datetime.date | datetime.datetime | None: """Get next connectivity time.""" now = dt_utils.now() current_event = self.get_event_at(now) - if not current_event: - return None # If current event is maybe, return the end time if self._event_to_state(current_event) == STATE_MAYBE: - return current_event.end + return current_event.end if current_event else None # Otherwise, return the next maybe event's end event = self._get_next_event_of_type(STATE_MAYBE) LOGGER.debug("Next connectivity: %s", event)