mirror of
https://github.com/home-assistant/core.git
synced 2026-07-11 08:39:02 +01:00
22 lines
653 B
Python
22 lines
653 B
Python
"""Provides conditions for updates."""
|
|
|
|
from homeassistant.const import STATE_OFF, STATE_ON
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.condition import Condition, make_entity_state_condition
|
|
|
|
from .const import DOMAIN
|
|
|
|
CONDITIONS: dict[str, type[Condition]] = {
|
|
"is_available": make_entity_state_condition(
|
|
DOMAIN, STATE_ON, support_duration=True
|
|
),
|
|
"is_not_available": make_entity_state_condition(
|
|
DOMAIN, STATE_OFF, support_duration=True
|
|
),
|
|
}
|
|
|
|
|
|
async def async_get_conditions(hass: HomeAssistant) -> dict[str, type[Condition]]:
|
|
"""Return the update conditions."""
|
|
return CONDITIONS
|