mirror of
https://github.com/home-assistant/frontend
synced 2024-09-28 00:43:28 +02: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
|
||||
): boolean {
|
||||
return conditions.every((c) => {
|
||||
if (!(c.entity in hass.states)) {
|
||||
return false;
|
||||
}
|
||||
if (c.state) {
|
||||
return hass.states[c.entity].state === c.state;
|
||||
}
|
||||
return hass!.states[c.entity].state !== c.state_not;
|
||||
const state = hass.states[c.entity]
|
||||
? hass!.states[c.entity].state
|
||||
: "unavailable";
|
||||
|
||||
return c.state ? state === c.state : state !== c.state_not;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user