Simplify fully closed or fully open check
This commit is contained in:
parent
fe5431976d
commit
58e968cf62
|
@ -19,14 +19,14 @@ export const enum CoverEntityFeature {
|
|||
}
|
||||
|
||||
export function isFullyOpen(stateObj: CoverEntity) {
|
||||
if (stateObj.attributes.current_position !== undefined) {
|
||||
if (stateObj.attributes.current_position != null) {
|
||||
return stateObj.attributes.current_position === 100;
|
||||
}
|
||||
return stateObj.state === "open";
|
||||
}
|
||||
|
||||
export function isFullyClosed(stateObj: CoverEntity) {
|
||||
if (stateObj.attributes.current_position !== undefined) {
|
||||
if (stateObj.attributes.current_position != null) {
|
||||
return stateObj.attributes.current_position === 0;
|
||||
}
|
||||
return stateObj.state === "closed";
|
||||
|
|
|
@ -14,20 +14,14 @@ export const enum ValveEntityFeature {
|
|||
}
|
||||
|
||||
export function isFullyOpen(stateObj: ValveEntity) {
|
||||
if (
|
||||
stateObj.attributes.current_position !== undefined &&
|
||||
stateObj.attributes.current_position !== null
|
||||
) {
|
||||
if (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 &&
|
||||
stateObj.attributes.current_position !== null
|
||||
) {
|
||||
if (stateObj.attributes.current_position != null) {
|
||||
return stateObj.attributes.current_position === 0;
|
||||
}
|
||||
return stateObj.state === "closed";
|
||||
|
|
Loading…
Reference in New Issue