Add new methods to DeviceAutomationTriggerProtocol (#72168)
* Add composite type * Add new methods to DeviceAutomationTriggerProtocolpull/72127/head
parent
17bb503450
commit
8a00281eaa
|
@ -1,4 +1,7 @@
|
|||
"""Offer device oriented automation."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable
|
||||
from typing import Protocol, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -14,6 +17,8 @@ from homeassistant.helpers.typing import ConfigType
|
|||
from . import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
DeviceAutomationType,
|
||||
GetAutomationCapabilitiesResult,
|
||||
GetAutomationsResult,
|
||||
async_get_device_automation_platform,
|
||||
)
|
||||
from .exceptions import InvalidDeviceAutomationConfig
|
||||
|
@ -33,7 +38,6 @@ class DeviceAutomationTriggerProtocol(Protocol):
|
|||
self, hass: HomeAssistant, config: ConfigType
|
||||
) -> ConfigType:
|
||||
"""Validate config."""
|
||||
raise NotImplementedError
|
||||
|
||||
async def async_attach_trigger(
|
||||
self,
|
||||
|
@ -43,7 +47,16 @@ class DeviceAutomationTriggerProtocol(Protocol):
|
|||
automation_info: AutomationTriggerInfo,
|
||||
) -> CALLBACK_TYPE:
|
||||
"""Attach a trigger."""
|
||||
raise NotImplementedError
|
||||
|
||||
def async_get_trigger_capabilities(
|
||||
self, hass: HomeAssistant, config: ConfigType
|
||||
) -> GetAutomationCapabilitiesResult | Awaitable[GetAutomationCapabilitiesResult]:
|
||||
"""List trigger capabilities."""
|
||||
|
||||
def async_get_triggers(
|
||||
self, hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult | Awaitable[GetAutomationsResult]:
|
||||
"""List triggers."""
|
||||
|
||||
|
||||
async def async_validate_trigger_config(
|
||||
|
|
Loading…
Reference in New Issue