Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion homeassistant/components/august/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ def _unsubscribe() -> None:
async def _async_refresh(self, time: datetime) -> None:
"""Refresh data."""

@callback
def _async_scheduled_refresh(self, now: datetime) -> None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an eager keyword for our listeners, or maybe a decorator for the functions we pass in ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking decorate coros like we do with @callback but I think after the initial flood of these we won't have that many. If I turn out to be wrong on that, I think I'll switch gears and add the decorator, but I don't want to put more checks in the HassJob path if it's not going to be more generally used

"""Call the refresh method."""
self._hass.async_create_task(self._async_refresh(now), eager_start=True)

@callback
def _async_setup_listeners(self) -> None:
"""Create interval and stop listeners."""
self._unsub_interval = async_track_time_interval(
self._hass,
self._async_refresh,
self._async_scheduled_refresh,
self._update_interval,
name="august refresh",
)
Expand Down