mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +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_START,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
from homeassistant.core import HassJob, HomeAssistant, ServiceCall, callback
|
||||||
from homeassistant.helpers import discovery, event
|
from homeassistant.helpers import discovery, event
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
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):
|
def _adapter_watchdog(now=None):
|
||||||
_LOGGER.debug("Reached _adapter_watchdog")
|
_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:
|
if not adapter.initialized:
|
||||||
_LOGGER.info("Adapter not initialized; Trying to restart")
|
_LOGGER.info("Adapter not initialized; Trying to restart")
|
||||||
hass.bus.fire(EVENT_HDMI_CEC_UNAVAILABLE)
|
hass.bus.fire(EVENT_HDMI_CEC_UNAVAILABLE)
|
||||||
adapter.init()
|
adapter.init()
|
||||||
|
|
||||||
|
_adapter_watchdog_job = HassJob(_adapter_watchdog, cancel_on_shutdown=True)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_initialized_callback(*_: Any):
|
def _async_initialized_callback(*_: Any):
|
||||||
"""Add watchdog on initialization."""
|
"""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)
|
hdmi_network.set_initialized_callback(_async_initialized_callback)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user