Skip to content

Commit

Permalink
fix: skip unavailable for incoming state change
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoim committed Jan 24, 2023
1 parent 6ff0858 commit b77af9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions reactive_home/src/composeables/useNewBoolean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ export function useNewBoolean(state: FullfilledUseState, debug = false) {
return;
}

if (newEntityState.state === "unavailable") {
if (debug) {
console.log(
`incoming(${state.value.entity_id}): skip. New state is unavailable`
);
}
return;
}

localValue.value = stringBoolToBool(newEntityState.state);
lastChanged.value = newEntityState.last_changed;
}
Expand Down
9 changes: 9 additions & 0 deletions reactive_home/src/composeables/useNewLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ export function useNewLight(state: FullfilledUseState, debug = false) {
);
}

if (newEntityState.state === "unavailable") {
if (debug) {
console.log(
`incoming(${state.value.entity_id}): skip. New state is unavailable`
);
}
return;
}

localValues.lastChanged = new Date(newEntityState.last_changed);

const contextIndex = skipContexts.findIndex(
Expand Down

0 comments on commit b77af9e

Please sign in to comment.