mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
fix valve entities row (#19278)
This commit is contained in:
parent
8d541595b8
commit
f147a5e909
@ -254,6 +254,7 @@ export const DOMAINS_INPUT_ROW = [
|
|||||||
"text",
|
"text",
|
||||||
"time",
|
"time",
|
||||||
"vacuum",
|
"vacuum",
|
||||||
|
"valve",
|
||||||
];
|
];
|
||||||
|
|
||||||
/** States that we consider "off". */
|
/** States that we consider "off". */
|
||||||
|
@ -14,14 +14,20 @@ export const enum ValveEntityFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isFullyOpen(stateObj: ValveEntity) {
|
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.attributes.current_position === 100;
|
||||||
}
|
}
|
||||||
return stateObj.state === "open";
|
return stateObj.state === "open";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isFullyClosed(stateObj: ValveEntity) {
|
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.attributes.current_position === 0;
|
||||||
}
|
}
|
||||||
return stateObj.state === "closed";
|
return stateObj.state === "closed";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user