mirror of
https://github.com/home-assistant/core.git
synced 2026-07-10 16:19:29 +01:00
22 lines
724 B
Python
22 lines
724 B
Python
"""Provides conditions for timers."""
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.condition import Condition, make_entity_state_condition
|
|
|
|
from . import DOMAIN, STATUS_ACTIVE, STATUS_IDLE, STATUS_PAUSED
|
|
|
|
CONDITIONS: dict[str, type[Condition]] = {
|
|
"is_active": make_entity_state_condition(
|
|
DOMAIN, STATUS_ACTIVE, support_duration=True
|
|
),
|
|
"is_paused": make_entity_state_condition(
|
|
DOMAIN, STATUS_PAUSED, support_duration=True
|
|
),
|
|
"is_idle": make_entity_state_condition(DOMAIN, STATUS_IDLE, support_duration=True),
|
|
}
|
|
|
|
|
|
async def async_get_conditions(hass: HomeAssistant) -> dict[str, type[Condition]]:
|
|
"""Return the timer conditions."""
|
|
return CONDITIONS
|