Allow empty string as a valid conditional statement (#14918)

* Fix days missing from ha-base-time-input _valueChanged

* style change

* Allow empty string as a valid conditional check
This commit is contained in:
karwosts 2023-01-23 11:27:02 -08:00 committed by GitHub
parent 9dcdf46316
commit 095ebbc903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,12 +16,14 @@ export function checkConditionsMet(
? hass!.states[c.entity].state
: UNAVAILABLE;
return c.state ? state === c.state : state !== c.state_not;
return c.state != null ? state === c.state : state !== c.state_not;
});
}
export function validateConditionalConfig(conditions: Condition[]): boolean {
return conditions.every(
(c) => (c.entity && (c.state || c.state_not)) as unknown as boolean
(c) =>
(c.entity &&
(c.state != null || c.state_not != null)) as unknown as boolean
);
}