mirror of
https://github.com/home-assistant/core.git
synced 2026-05-21 07:50:23 +01:00
24 lines
610 B
Python
24 lines
610 B
Python
"""Provides triggers for buttons."""
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.automation import DomainSpec
|
|
from homeassistant.helpers.trigger import StatelessEntityTriggerBase, Trigger
|
|
|
|
from . import DOMAIN
|
|
|
|
|
|
class ButtonPressedTrigger(StatelessEntityTriggerBase):
|
|
"""Trigger for button entity presses."""
|
|
|
|
_domain_specs = {DOMAIN: DomainSpec()}
|
|
|
|
|
|
TRIGGERS: dict[str, type[Trigger]] = {
|
|
"pressed": ButtonPressedTrigger,
|
|
}
|
|
|
|
|
|
async def async_get_triggers(hass: HomeAssistant) -> dict[str, type[Trigger]]:
|
|
"""Return the triggers for buttons."""
|
|
return TRIGGERS
|