mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Adjust device_automation type hints in litejet (#72195)
This commit is contained in:
parent
cc7a0e3c24
commit
30bf727dfe
@ -1,12 +1,19 @@
|
|||||||
"""Trigger an automation when a LiteJet switch is released."""
|
"""Trigger an automation when a LiteJet switch is released."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.components.automation import (
|
||||||
|
AutomationActionType,
|
||||||
|
AutomationTriggerInfo,
|
||||||
|
)
|
||||||
from homeassistant.const import CONF_PLATFORM
|
from homeassistant.const import CONF_PLATFORM
|
||||||
from homeassistant.core import HassJob, callback
|
from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.event import track_point_in_utc_time
|
from homeassistant.helpers.event import track_point_in_utc_time
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -29,14 +36,19 @@ TRIGGER_SCHEMA = cv.TRIGGER_BASE_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_attach_trigger(hass, config, action, automation_info):
|
async def async_attach_trigger(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
action: AutomationActionType,
|
||||||
|
automation_info: AutomationTriggerInfo,
|
||||||
|
) -> CALLBACK_TYPE:
|
||||||
"""Listen for events based on configuration."""
|
"""Listen for events based on configuration."""
|
||||||
trigger_data = automation_info["trigger_data"]
|
trigger_data = automation_info["trigger_data"]
|
||||||
number = config.get(CONF_NUMBER)
|
number = config.get(CONF_NUMBER)
|
||||||
held_more_than = config.get(CONF_HELD_MORE_THAN)
|
held_more_than = config.get(CONF_HELD_MORE_THAN)
|
||||||
held_less_than = config.get(CONF_HELD_LESS_THAN)
|
held_less_than = config.get(CONF_HELD_LESS_THAN)
|
||||||
pressed_time = None
|
pressed_time = None
|
||||||
cancel_pressed_more_than: Callable = None
|
cancel_pressed_more_than: Callable | None = None
|
||||||
job = HassJob(action)
|
job = HassJob(action)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user