mirror of
https://github.com/home-assistant/core.git
synced 2026-01-25 00:52:39 +01:00
18 lines
604 B
Python
18 lines
604 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),
|
|
"is_not_home": make_entity_state_condition(DOMAIN, STATE_NOT_HOME),
|
|
}
|
|
|
|
|
|
async def async_get_conditions(hass: HomeAssistant) -> dict[str, type[Condition]]:
|
|
"""Return the conditions for device trackers."""
|
|
return CONDITIONS
|