mirror of
https://github.com/home-assistant/core.git
synced 2026-07-15 18:44:20 +01:00
27 lines
836 B
Python
27 lines
836 B
Python
"""Provides conditions for locks."""
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.condition import Condition, make_entity_state_condition
|
|
|
|
from .const import DOMAIN, LockState
|
|
|
|
CONDITIONS: dict[str, type[Condition]] = {
|
|
"is_jammed": make_entity_state_condition(
|
|
DOMAIN, LockState.JAMMED, support_duration=True
|
|
),
|
|
"is_locked": make_entity_state_condition(
|
|
DOMAIN, LockState.LOCKED, support_duration=True
|
|
),
|
|
"is_open": make_entity_state_condition(
|
|
DOMAIN, LockState.OPEN, support_duration=True
|
|
),
|
|
"is_unlocked": make_entity_state_condition(
|
|
DOMAIN, LockState.UNLOCKED, support_duration=True
|
|
),
|
|
}
|
|
|
|
|
|
async def async_get_conditions(hass: HomeAssistant) -> dict[str, type[Condition]]:
|
|
"""Return the conditions for locks."""
|
|
return CONDITIONS
|