mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Only use the state to mark updates as pending (#12171)
This commit is contained in:
parent
4c3baa678c
commit
bf35ee549d
@ -2,6 +2,7 @@ import type {
|
|||||||
HassEntityAttributeBase,
|
HassEntityAttributeBase,
|
||||||
HassEntityBase,
|
HassEntityBase,
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
|
import { BINARY_STATE_ON } from "../common/const";
|
||||||
import { supportsFeature } from "../common/entity/supports-feature";
|
import { supportsFeature } from "../common/entity/supports-feature";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
|
|
||||||
@ -30,9 +31,8 @@ export const updateUsesProgress = (entity: UpdateEntity): boolean =>
|
|||||||
typeof entity.attributes.in_progress === "number";
|
typeof entity.attributes.in_progress === "number";
|
||||||
|
|
||||||
export const updateCanInstall = (entity: UpdateEntity): boolean =>
|
export const updateCanInstall = (entity: UpdateEntity): boolean =>
|
||||||
supportsFeature(entity, UPDATE_SUPPORT_INSTALL) &&
|
entity.state === BINARY_STATE_ON &&
|
||||||
entity.attributes.latest_version !== entity.attributes.current_version &&
|
supportsFeature(entity, UPDATE_SUPPORT_INSTALL);
|
||||||
entity.attributes.latest_version !== entity.attributes.skipped_version;
|
|
||||||
|
|
||||||
export const updateIsInstalling = (entity: UpdateEntity): boolean =>
|
export const updateIsInstalling = (entity: UpdateEntity): boolean =>
|
||||||
updateUsesProgress(entity) || !!entity.attributes.in_progress;
|
updateUsesProgress(entity) || !!entity.attributes.in_progress;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user