mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
Revert "Don't check for entity id in state condition"
This reverts commit f5e6a65a370c108cb68876aeeafe348eead6e8be.
This commit is contained in:
parent
52370a6fd7
commit
c43c06d6e6
@ -25,8 +25,8 @@ interface BaseCondition {
|
|||||||
export interface NumericStateCondition extends BaseCondition {
|
export interface NumericStateCondition extends BaseCondition {
|
||||||
condition: "numeric_state";
|
condition: "numeric_state";
|
||||||
entity?: string;
|
entity?: string;
|
||||||
below?: string | number; // string for entity_id
|
below?: string | number;
|
||||||
above?: string | number; // string for entity_id
|
above?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StateCondition extends BaseCondition {
|
export interface StateCondition extends BaseCondition {
|
||||||
@ -80,10 +80,16 @@ function checkStateCondition(
|
|||||||
condition.entity && hass.states[condition.entity]
|
condition.entity && hass.states[condition.entity]
|
||||||
? hass.states[condition.entity].state
|
? hass.states[condition.entity].state
|
||||||
: UNAVAILABLE;
|
: UNAVAILABLE;
|
||||||
|
let value = condition.state ?? condition.state_not;
|
||||||
|
|
||||||
|
// Handle entity_id, UI should be updated for conditionnal card (filters does not have UI for now)
|
||||||
|
if (Array.isArray(value) || typeof value === "string") {
|
||||||
|
value = getValueFromEntityId(hass, value);
|
||||||
|
}
|
||||||
|
|
||||||
return condition.state != null
|
return condition.state != null
|
||||||
? ensureArray(condition.state).includes(state)
|
? ensureArray(value).includes(state)
|
||||||
: !ensureArray(condition.state_not).includes(state);
|
: !ensureArray(value).includes(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkStateNumericCondition(
|
function checkStateNumericCondition(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user