mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Handle unavailable entity in conditional-card (#2996)
* Handle unavailable entity in conditional-card * cleanup
This commit is contained in:
parent
8aa501b7bd
commit
e2a9cf0d3c
@ -11,13 +11,11 @@ export function checkConditionsMet(
|
|||||||
hass: HomeAssistant
|
hass: HomeAssistant
|
||||||
): boolean {
|
): boolean {
|
||||||
return conditions.every((c) => {
|
return conditions.every((c) => {
|
||||||
if (!(c.entity in hass.states)) {
|
const state = hass.states[c.entity]
|
||||||
return false;
|
? hass!.states[c.entity].state
|
||||||
}
|
: "unavailable";
|
||||||
if (c.state) {
|
|
||||||
return hass.states[c.entity].state === c.state;
|
return c.state ? state === c.state : state !== c.state_not;
|
||||||
}
|
|
||||||
return hass!.states[c.entity].state !== c.state_not;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user