mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix lingering timer in hdmi_cec (#92579)
This commit is contained in:
parent
e55f2173f8
commit
6f3c9324ac
@ -31,7 +31,7 @@ from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.core import HassJob, HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import discovery, event
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@ -208,16 +208,18 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901
|
||||
|
||||
def _adapter_watchdog(now=None):
|
||||
_LOGGER.debug("Reached _adapter_watchdog")
|
||||
event.call_later(hass, WATCHDOG_INTERVAL, _adapter_watchdog)
|
||||
event.call_later(hass, WATCHDOG_INTERVAL, _adapter_watchdog_job)
|
||||
if not adapter.initialized:
|
||||
_LOGGER.info("Adapter not initialized; Trying to restart")
|
||||
hass.bus.fire(EVENT_HDMI_CEC_UNAVAILABLE)
|
||||
adapter.init()
|
||||
|
||||
_adapter_watchdog_job = HassJob(_adapter_watchdog, cancel_on_shutdown=True)
|
||||
|
||||
@callback
|
||||
def _async_initialized_callback(*_: Any):
|
||||
"""Add watchdog on initialization."""
|
||||
return event.async_call_later(hass, WATCHDOG_INTERVAL, _adapter_watchdog)
|
||||
return event.async_call_later(hass, WATCHDOG_INTERVAL, _adapter_watchdog_job)
|
||||
|
||||
hdmi_network.set_initialized_callback(_async_initialized_callback)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user