mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +02:00
Drop GetAutomationsResult and GetAutomationCapabilitiesResult aliases (#72328)
This commit is contained in:
parent
31b53e7fc6
commit
421167c548
@ -7,10 +7,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_DEVICE_ID,
|
||||
@ -36,7 +33,7 @@ TRIGGER_SCHEMA = DEVICE_TRIGGER_BASE_SCHEMA.extend(
|
||||
|
||||
async def async_get_triggers(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for Arcam FMJ Receiver control devices."""
|
||||
registry = entity_registry.async_get(hass)
|
||||
triggers = []
|
||||
|
@ -44,9 +44,6 @@ if TYPE_CHECKING:
|
||||
]
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs
|
||||
GetAutomationsResult = list[dict[str, Any]]
|
||||
GetAutomationCapabilitiesResult = dict[str, vol.Schema]
|
||||
|
||||
DOMAIN = "device_automation"
|
||||
|
||||
DEVICE_TRIGGER_BASE_SCHEMA = cv.TRIGGER_BASE_SCHEMA.extend(
|
||||
|
@ -10,12 +10,7 @@ from homeassistant.const import CONF_DOMAIN
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
DeviceAutomationType,
|
||||
GetAutomationCapabilitiesResult,
|
||||
GetAutomationsResult,
|
||||
async_get_device_automation_platform,
|
||||
)
|
||||
from . import DeviceAutomationType, async_get_device_automation_platform
|
||||
from .exceptions import InvalidDeviceAutomationConfig
|
||||
|
||||
|
||||
@ -43,12 +38,12 @@ class DeviceAutomationActionProtocol(Protocol):
|
||||
|
||||
def async_get_action_capabilities(
|
||||
self, hass: HomeAssistant, config: ConfigType
|
||||
) -> GetAutomationCapabilitiesResult | Awaitable[GetAutomationCapabilitiesResult]:
|
||||
) -> dict[str, vol.Schema] | Awaitable[dict[str, vol.Schema]]:
|
||||
"""List action capabilities."""
|
||||
|
||||
def async_get_actions(
|
||||
self, hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult | Awaitable[GetAutomationsResult]:
|
||||
) -> list[dict[str, Any]] | Awaitable[list[dict[str, Any]]]:
|
||||
"""List actions."""
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable
|
||||
from typing import TYPE_CHECKING, Protocol, cast
|
||||
from typing import TYPE_CHECKING, Any, Protocol, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@ -11,12 +11,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import (
|
||||
DeviceAutomationType,
|
||||
GetAutomationCapabilitiesResult,
|
||||
GetAutomationsResult,
|
||||
async_get_device_automation_platform,
|
||||
)
|
||||
from . import DeviceAutomationType, async_get_device_automation_platform
|
||||
from .exceptions import InvalidDeviceAutomationConfig
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -43,12 +38,12 @@ class DeviceAutomationConditionProtocol(Protocol):
|
||||
|
||||
def async_get_condition_capabilities(
|
||||
self, hass: HomeAssistant, config: ConfigType
|
||||
) -> GetAutomationCapabilitiesResult | Awaitable[GetAutomationCapabilitiesResult]:
|
||||
) -> dict[str, vol.Schema] | Awaitable[dict[str, vol.Schema]]:
|
||||
"""List condition capabilities."""
|
||||
|
||||
def async_get_conditions(
|
||||
self, hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult | Awaitable[GetAutomationsResult]:
|
||||
) -> list[dict[str, Any]] | Awaitable[list[dict[str, Any]]]:
|
||||
"""List conditions."""
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable
|
||||
from typing import Protocol, cast
|
||||
from typing import Any, Protocol, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@ -17,8 +17,6 @@ from homeassistant.helpers.typing import ConfigType
|
||||
from . import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
DeviceAutomationType,
|
||||
GetAutomationCapabilitiesResult,
|
||||
GetAutomationsResult,
|
||||
async_get_device_automation_platform,
|
||||
)
|
||||
from .exceptions import InvalidDeviceAutomationConfig
|
||||
@ -50,12 +48,12 @@ class DeviceAutomationTriggerProtocol(Protocol):
|
||||
|
||||
def async_get_trigger_capabilities(
|
||||
self, hass: HomeAssistant, config: ConfigType
|
||||
) -> GetAutomationCapabilitiesResult | Awaitable[GetAutomationCapabilitiesResult]:
|
||||
) -> dict[str, vol.Schema] | Awaitable[dict[str, vol.Schema]]:
|
||||
"""List trigger capabilities."""
|
||||
|
||||
def async_get_triggers(
|
||||
self, hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult | Awaitable[GetAutomationsResult]:
|
||||
) -> list[dict[str, Any]] | Awaitable[list[dict[str, Any]]]:
|
||||
"""List triggers."""
|
||||
|
||||
|
||||
|
@ -14,10 +14,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_PLATFORM, CONF_TYPE
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
@ -244,7 +241,7 @@ def async_fire_triggers(conn: HKDevice, events: dict[tuple[int, int], Any]):
|
||||
|
||||
async def async_get_triggers(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for homekit devices."""
|
||||
|
||||
if device_id not in hass.data.get(TRIGGERS, {}):
|
||||
|
@ -7,10 +7,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
@ -350,7 +347,7 @@ async def async_validate_trigger_config(
|
||||
|
||||
async def async_get_triggers(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for lutron caseta devices."""
|
||||
triggers = []
|
||||
|
||||
|
@ -8,10 +8,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
@ -66,7 +63,7 @@ def async_get_device_trigger_types(
|
||||
|
||||
async def async_get_triggers(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for a Nest device."""
|
||||
nest_device_id = async_get_nest_device_id(hass, device_id)
|
||||
if not nest_device_id:
|
||||
|
@ -7,10 +7,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
@ -101,7 +98,7 @@ async def async_validate_trigger_config(
|
||||
|
||||
async def async_get_triggers(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for Netatmo devices."""
|
||||
registry = entity_registry.async_get(hass)
|
||||
device_registry = dr.async_get(hass)
|
||||
|
@ -9,10 +9,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
@ -111,9 +108,9 @@ async def async_validate_trigger_config(
|
||||
|
||||
async def async_get_triggers(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for Shelly devices."""
|
||||
triggers: GetAutomationsResult = []
|
||||
triggers: list[dict[str, str]] = []
|
||||
|
||||
if rpc_wrapper := get_rpc_device_wrapper(hass, device_id):
|
||||
input_triggers = get_rpc_input_triggers(rpc_wrapper.device)
|
||||
|
@ -7,10 +7,7 @@ from homeassistant.components.automation import (
|
||||
AutomationActionType,
|
||||
AutomationTriggerInfo,
|
||||
)
|
||||
from homeassistant.components.device_automation import (
|
||||
DEVICE_TRIGGER_BASE_SCHEMA,
|
||||
GetAutomationsResult,
|
||||
)
|
||||
from homeassistant.components.device_automation import DEVICE_TRIGGER_BASE_SCHEMA
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
@ -61,7 +58,7 @@ async def async_validate_trigger_config(
|
||||
|
||||
async def async_get_triggers(
|
||||
_hass: HomeAssistant, device_id: str
|
||||
) -> GetAutomationsResult:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device triggers for device."""
|
||||
triggers = []
|
||||
base_trigger = {
|
||||
|
Loading…
Reference in New Issue
Block a user