mirror of
https://github.com/home-assistant/core.git
synced 2026-05-19 15:00:27 +01:00
30 lines
835 B
Python
30 lines
835 B
Python
"""Provides triggers for selects."""
|
|
|
|
from homeassistant.components.input_select import DOMAIN as INPUT_SELECT_DOMAIN
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.automation import DomainSpec
|
|
from homeassistant.helpers.trigger import (
|
|
ENTITY_STATE_TRIGGER_SCHEMA,
|
|
EntityTriggerBase,
|
|
Trigger,
|
|
)
|
|
|
|
from .const import DOMAIN
|
|
|
|
|
|
class SelectionChangedTrigger(EntityTriggerBase):
|
|
"""Trigger for select entity when its selection changes."""
|
|
|
|
_domain_specs = {DOMAIN: DomainSpec(), INPUT_SELECT_DOMAIN: DomainSpec()}
|
|
_schema = ENTITY_STATE_TRIGGER_SCHEMA
|
|
|
|
|
|
TRIGGERS: dict[str, type[Trigger]] = {
|
|
"selection_changed": SelectionChangedTrigger,
|
|
}
|
|
|
|
|
|
async def async_get_triggers(hass: HomeAssistant) -> dict[str, type[Trigger]]:
|
|
"""Return the triggers for selects."""
|
|
return TRIGGERS
|