mirror of
https://github.com/home-assistant/core.git
synced 2025-11-27 03:28:04 +00:00
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com> Co-authored-by: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com> Co-authored-by: abmantis <amfcalt@gmail.com> Co-authored-by: Bram Kragten <mail@bramkragten.nl> Co-authored-by: Franck Nijhof <git@frenck.dev> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
"""Provides triggers for climates."""
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.trigger import (
|
|
Trigger,
|
|
make_conditional_entity_state_trigger,
|
|
make_entity_state_attribute_trigger,
|
|
make_entity_state_trigger,
|
|
)
|
|
|
|
from .const import ATTR_HVAC_ACTION, DOMAIN, HVACAction, HVACMode
|
|
|
|
TRIGGERS: dict[str, type[Trigger]] = {
|
|
"turned_off": make_entity_state_trigger(DOMAIN, HVACMode.OFF),
|
|
"turned_on": make_conditional_entity_state_trigger(
|
|
DOMAIN,
|
|
from_states={
|
|
HVACMode.OFF,
|
|
},
|
|
to_states={
|
|
HVACMode.AUTO,
|
|
HVACMode.COOL,
|
|
HVACMode.DRY,
|
|
HVACMode.FAN_ONLY,
|
|
HVACMode.HEAT,
|
|
HVACMode.HEAT_COOL,
|
|
},
|
|
),
|
|
"started_heating": make_entity_state_attribute_trigger(
|
|
DOMAIN, ATTR_HVAC_ACTION, HVACAction.HEATING
|
|
),
|
|
}
|
|
|
|
|
|
async def async_get_triggers(hass: HomeAssistant) -> dict[str, type[Trigger]]:
|
|
"""Return the triggers for climates."""
|
|
return TRIGGERS
|