mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix lingering timer in hassio (#91702)
This commit is contained in:
parent
cf4c491e79
commit
821b9bdb5f
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from datetime import timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Any, NamedTuple
|
from typing import Any, NamedTuple
|
||||||
@ -29,6 +29,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import (
|
from homeassistant.core import (
|
||||||
DOMAIN as HASS_DOMAIN,
|
DOMAIN as HASS_DOMAIN,
|
||||||
|
HassJob,
|
||||||
HomeAssistant,
|
HomeAssistant,
|
||||||
ServiceCall,
|
ServiceCall,
|
||||||
callback,
|
callback,
|
||||||
@ -492,7 +493,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
DOMAIN, service, async_service_handler, schema=settings.schema
|
DOMAIN, service, async_service_handler, schema=settings.schema
|
||||||
)
|
)
|
||||||
|
|
||||||
async def update_info_data(now):
|
async def update_info_data(_: datetime | None = None) -> None:
|
||||||
"""Update last available supervisor information."""
|
"""Update last available supervisor information."""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -516,11 +517,13 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
|
|||||||
_LOGGER.warning("Can't read Supervisor data: %s", err)
|
_LOGGER.warning("Can't read Supervisor data: %s", err)
|
||||||
|
|
||||||
async_track_point_in_utc_time(
|
async_track_point_in_utc_time(
|
||||||
hass, update_info_data, utcnow() + HASSIO_UPDATE_INTERVAL
|
hass,
|
||||||
|
HassJob(update_info_data, cancel_on_shutdown=True),
|
||||||
|
utcnow() + HASSIO_UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Fetch data
|
# Fetch data
|
||||||
await update_info_data(None)
|
await update_info_data()
|
||||||
|
|
||||||
async def async_handle_core_service(call: ServiceCall) -> None:
|
async def async_handle_core_service(call: ServiceCall) -> None:
|
||||||
"""Service handler for handling core services."""
|
"""Service handler for handling core services."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user