1 """Provides device automations for control of device."""
3 from __future__
import annotations
5 import voluptuous
as vol
18 from .const
import DOMAIN, TRIGGER_TYPE_TURN_ON
19 from .helpers
import async_get_turn_on_trigger
21 TRIGGER_TYPES = {TRIGGER_TYPE_TURN_ON}
22 TRIGGER_SCHEMA = DEVICE_TRIGGER_BASE_SCHEMA.extend(
24 vol.Required(CONF_TYPE): vol.In(TRIGGER_TYPES),
30 hass: HomeAssistant, device_id: str
31 ) -> list[dict[str, str]]:
32 """List device triggers for device."""
42 action: TriggerActionType,
43 trigger_info: TriggerInfo,
45 """Attach a trigger."""
46 trigger_data = trigger_info[
"trigger_data"]
47 if (trigger_type := config[CONF_TYPE]) == TRIGGER_TYPE_TURN_ON:
53 "device_id": config[CONF_DEVICE_ID],
54 "description": f
"philips_js '{trigger_type}' event",
59 return PluggableAction.async_attach_trigger(
60 hass, turn_on_trigger, action, variables
dict[str, str] async_get_turn_on_trigger(str device_id)
list[dict[str, str]] async_get_triggers(HomeAssistant hass, str device_id)
CALLBACK_TYPE async_attach_trigger(HomeAssistant hass, ConfigType config, TriggerActionType action, TriggerInfo trigger_info)