Add support for the DataUpdateCoordinator to not automatically update (#37734)
This commit is contained in:
parent
52939865fa
commit
0db8140c13
2 changed files with 67 additions and 5 deletions
|
@ -30,7 +30,7 @@ class DataUpdateCoordinator:
|
|||
logger: logging.Logger,
|
||||
*,
|
||||
name: str,
|
||||
update_interval: timedelta,
|
||||
update_interval: Optional[timedelta] = None,
|
||||
update_method: Optional[Callable[[], Awaitable]] = None,
|
||||
request_refresh_debouncer: Optional[Debouncer] = None,
|
||||
):
|
||||
|
@ -91,6 +91,9 @@ class DataUpdateCoordinator:
|
|||
@callback
|
||||
def _schedule_refresh(self) -> None:
|
||||
"""Schedule a refresh."""
|
||||
if self.update_interval is None:
|
||||
return
|
||||
|
||||
if self._unsub_refresh:
|
||||
self._unsub_refresh()
|
||||
self._unsub_refresh = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue