mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Allow initialized callback to have arguments (#58129)
This commit is contained in:
parent
0f25900309
commit
b368476429
@ -1,9 +1,10 @@
|
|||||||
"""Support for HDMI CEC."""
|
"""Support for HDMI CEC."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from functools import partial, reduce
|
from functools import reduce
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from pycec.cec import CecAdapter
|
from pycec.cec import CecAdapter
|
||||||
from pycec.commands import CecCommand, KeyPressCommand, KeyReleaseCommand
|
from pycec.commands import CecCommand, KeyPressCommand, KeyReleaseCommand
|
||||||
@ -41,7 +42,7 @@ from homeassistant.const import (
|
|||||||
STATE_PLAYING,
|
STATE_PLAYING,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, 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
|
||||||
@ -222,9 +223,12 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: # noqa: C901
|
|||||||
hass.bus.fire(EVENT_HDMI_CEC_UNAVAILABLE)
|
hass.bus.fire(EVENT_HDMI_CEC_UNAVAILABLE)
|
||||||
adapter.init()
|
adapter.init()
|
||||||
|
|
||||||
hdmi_network.set_initialized_callback(
|
@callback
|
||||||
partial(event.async_call_later, hass, WATCHDOG_INTERVAL, _adapter_watchdog)
|
def _async_initialized_callback(*_: Any):
|
||||||
)
|
"""Add watchdog on initialization."""
|
||||||
|
return event.async_call_later(hass, WATCHDOG_INTERVAL, _adapter_watchdog)
|
||||||
|
|
||||||
|
hdmi_network.set_initialized_callback(_async_initialized_callback)
|
||||||
|
|
||||||
def _volume(call):
|
def _volume(call):
|
||||||
"""Increase/decrease volume and mute/unmute system."""
|
"""Increase/decrease volume and mute/unmute system."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user