mirror of
https://github.com/home-assistant/core.git
synced 2026-04-20 08:29:39 +02:00
20 lines
664 B
Python
20 lines
664 B
Python
"""Provides conditions for device trackers."""
|
|
|
|
from homeassistant.const import STATE_HOME, STATE_NOT_HOME
|
|
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_home": make_entity_state_condition(DOMAIN, STATE_HOME, support_duration=True),
|
|
"is_not_home": make_entity_state_condition(
|
|
DOMAIN, STATE_NOT_HOME, support_duration=True
|
|
),
|
|
}
|
|
|
|
|
|
async def async_get_conditions(hass: HomeAssistant) -> dict[str, type[Condition]]:
|
|
"""Return the conditions for device trackers."""
|
|
return CONDITIONS
|