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."""
|
"""Offer device oriented automation."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Awaitable
|
||||||
from typing import Protocol, cast
|
from typing import Protocol, cast
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
@ -14,6 +17,8 @@ from homeassistant.helpers.typing import ConfigType
|
||||||
from . import (
|
from . import (
|
||||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||||
DeviceAutomationType,
|
DeviceAutomationType,
|
||||||
|
GetAutomationCapabilitiesResult,
|
||||||
|
GetAutomationsResult,
|
||||||
async_get_device_automation_platform,
|
async_get_device_automation_platform,
|
||||||
)
|
)
|
||||||
from .exceptions import InvalidDeviceAutomationConfig
|
from .exceptions import InvalidDeviceAutomationConfig
|
||||||
|
@ -33,7 +38,6 @@ class DeviceAutomationTriggerProtocol(Protocol):
|
||||||
self, hass: HomeAssistant, config: ConfigType
|
self, hass: HomeAssistant, config: ConfigType
|
||||||
) -> ConfigType:
|
) -> ConfigType:
|
||||||
"""Validate config."""
|
"""Validate config."""
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
async def async_attach_trigger(
|
async def async_attach_trigger(
|
||||||
self,
|
self,
|
||||||
|
@ -43,7 +47,16 @@ class DeviceAutomationTriggerProtocol(Protocol):
|
||||||
automation_info: AutomationTriggerInfo,
|
automation_info: AutomationTriggerInfo,
|
||||||
) -> CALLBACK_TYPE:
|
) -> CALLBACK_TYPE:
|
||||||
"""Attach a trigger."""
|
"""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(
|
async def async_validate_trigger_config(
|
||||||
|
|
Loading…
Reference in New Issue