1 """Provides device triggers for switches."""
3 from __future__
import annotations
5 import voluptuous
as vol
15 TRIGGER_SCHEMA = vol.All(
16 toggle_entity.TRIGGER_SCHEMA,
17 vol.Schema({vol.Required(CONF_DOMAIN): DOMAIN}, extra=vol.ALLOW_EXTRA),
24 action: TriggerActionType,
25 trigger_info: TriggerInfo,
27 """Listen for state changes based on configuration."""
28 return await toggle_entity.async_attach_trigger(hass, config, action, trigger_info)
32 hass: HomeAssistant, device_id: str
33 ) -> list[dict[str, str]]:
34 """List device triggers."""
35 return await toggle_entity.async_get_triggers(hass, device_id, DOMAIN)
39 hass: HomeAssistant, config: ConfigType
40 ) -> dict[str, vol.Schema]:
41 """List trigger capabilities."""
42 return await toggle_entity.async_get_trigger_capabilities(hass, config)
CALLBACK_TYPE async_attach_trigger(HomeAssistant hass, ConfigType config, TriggerActionType action, TriggerInfo trigger_info)
dict[str, vol.Schema] async_get_trigger_capabilities(HomeAssistant hass, ConfigType config)
list[dict[str, str]] async_get_triggers(HomeAssistant hass, str device_id)