mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Fix implicit reexport [helpers.condition] (#63830)
This commit is contained in:
parent
1dd87810bc
commit
4d76ed9ceb
@ -4,7 +4,13 @@ from __future__ import annotations
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.device_automation.const import CONF_IS_OFF, CONF_IS_ON
|
||||
from homeassistant.const import CONF_ENTITY_ID, CONF_FOR, CONF_TYPE
|
||||
from homeassistant.const import (
|
||||
CONF_CONDITION,
|
||||
CONF_ENTITY_ID,
|
||||
CONF_FOR,
|
||||
CONF_STATE,
|
||||
CONF_TYPE,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import condition, config_validation as cv
|
||||
from homeassistant.helpers.entity import get_device_class
|
||||
@ -301,9 +307,9 @@ def async_condition_from_config(
|
||||
else:
|
||||
stat = "off"
|
||||
state_config = {
|
||||
condition.CONF_CONDITION: "state",
|
||||
condition.CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
condition.CONF_STATE: stat,
|
||||
CONF_CONDITION: "state",
|
||||
CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
CONF_STATE: stat,
|
||||
}
|
||||
if CONF_FOR in config:
|
||||
state_config[CONF_FOR] = config[CONF_FOR]
|
||||
|
@ -16,6 +16,7 @@ from homeassistant.const import (
|
||||
CONF_ENTITY_ID,
|
||||
CONF_FOR,
|
||||
CONF_PLATFORM,
|
||||
CONF_STATE,
|
||||
CONF_TYPE,
|
||||
)
|
||||
from homeassistant.core import CALLBACK_TYPE, Context, HomeAssistant, callback
|
||||
@ -138,9 +139,9 @@ def async_condition_from_config(
|
||||
else:
|
||||
stat = "off"
|
||||
state_config = {
|
||||
condition.CONF_CONDITION: "state",
|
||||
condition.CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
condition.CONF_STATE: stat,
|
||||
CONF_CONDITION: "state",
|
||||
CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
CONF_STATE: stat,
|
||||
}
|
||||
if CONF_FOR in config:
|
||||
state_config[CONF_FOR] = config[CONF_FOR]
|
||||
|
@ -6,7 +6,13 @@ import voluptuous as vol
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
from homeassistant.const import CONF_ABOVE, CONF_BELOW, CONF_ENTITY_ID, CONF_TYPE
|
||||
from homeassistant.const import (
|
||||
CONF_ABOVE,
|
||||
CONF_BELOW,
|
||||
CONF_CONDITION,
|
||||
CONF_ENTITY_ID,
|
||||
CONF_TYPE,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import condition, config_validation as cv
|
||||
@ -169,13 +175,13 @@ def async_condition_from_config(
|
||||
) -> condition.ConditionCheckerType:
|
||||
"""Evaluate state based on configuration."""
|
||||
numeric_state_config = {
|
||||
condition.CONF_CONDITION: "numeric_state",
|
||||
condition.CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
CONF_CONDITION: "numeric_state",
|
||||
CONF_ENTITY_ID: config[CONF_ENTITY_ID],
|
||||
}
|
||||
if CONF_ABOVE in config:
|
||||
numeric_state_config[condition.CONF_ABOVE] = config[CONF_ABOVE]
|
||||
numeric_state_config[CONF_ABOVE] = config[CONF_ABOVE]
|
||||
if CONF_BELOW in config:
|
||||
numeric_state_config[condition.CONF_BELOW] = config[CONF_BELOW]
|
||||
numeric_state_config[CONF_BELOW] = config[CONF_BELOW]
|
||||
|
||||
numeric_state_config = cv.NUMERIC_STATE_CONDITION_SCHEMA(numeric_state_config)
|
||||
numeric_state_config = condition.numeric_state_validate_config(
|
||||
|
Loading…
x
Reference in New Issue
Block a user