diff --git a/src/common/const.ts b/src/common/const.ts index bc114f2f1703..2e7d2f7c77d7 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -254,6 +254,7 @@ export const DOMAINS_INPUT_ROW = [ "text", "time", "vacuum", + "valve", ]; /** States that we consider "off". */ diff --git a/src/data/valve.ts b/src/data/valve.ts index 73f5d428ae18..645ca82e4954 100644 --- a/src/data/valve.ts +++ b/src/data/valve.ts @@ -14,14 +14,20 @@ export const enum ValveEntityFeature { } export function isFullyOpen(stateObj: ValveEntity) { - if (stateObj.attributes.current_position !== undefined) { + if ( + stateObj.attributes.current_position !== undefined && + stateObj.attributes.current_position !== null + ) { return stateObj.attributes.current_position === 100; } return stateObj.state === "open"; } export function isFullyClosed(stateObj: ValveEntity) { - if (stateObj.attributes.current_position !== undefined) { + if ( + stateObj.attributes.current_position !== undefined && + stateObj.attributes.current_position !== null + ) { return stateObj.attributes.current_position === 0; } return stateObj.state === "closed";