diff --git a/src/data/update.ts b/src/data/update.ts index 5423e4f477..1816bc8677 100644 --- a/src/data/update.ts +++ b/src/data/update.ts @@ -24,12 +24,13 @@ export enum UpdateEntityFeature { interface UpdateEntityAttributes extends HassEntityAttributeBase { auto_update: boolean | null; installed_version: string | null; - in_progress: boolean | number; + in_progress: boolean; latest_version: string | null; release_summary: string | null; release_url: string | null; skipped_version: string | null; title: string | null; + update_percentage: number | null; } export interface UpdateEntity extends HassEntityBase { @@ -38,7 +39,7 @@ export interface UpdateEntity extends HassEntityBase { export const updateUsesProgress = (entity: UpdateEntity): boolean => supportsFeature(entity, UpdateEntityFeature.PROGRESS) && - typeof entity.attributes.in_progress === "number"; + entity.attributes.update_percentage !== null; export const updateCanInstall = ( entity: UpdateEntity, @@ -49,7 +50,7 @@ export const updateCanInstall = ( supportsFeature(entity, UpdateEntityFeature.INSTALL); export const updateIsInstalling = (entity: UpdateEntity): boolean => - updateUsesProgress(entity) || !!entity.attributes.in_progress; + !!entity.attributes.in_progress; export const updateReleaseNotes = (hass: HomeAssistant, entityId: string) => hass.callWS({ @@ -183,10 +184,10 @@ export const computeUpdateStateDisplay = ( if (updateIsInstalling(stateObj)) { const supportsProgress = supportsFeature(stateObj, UpdateEntityFeature.PROGRESS) && - typeof attributes.in_progress === "number"; + attributes.update_percentage !== null; if (supportsProgress) { return hass.localize("ui.card.update.installing_with_progress", { - progress: attributes.in_progress as number, + progress: attributes.update_percentage, }); } return hass.localize("ui.card.update.installing"); diff --git a/src/dialogs/more-info/controls/more-info-update.ts b/src/dialogs/more-info/controls/more-info-update.ts index 521d924589..1e7199e2c9 100644 --- a/src/dialogs/more-info/controls/more-info-update.ts +++ b/src/dialogs/more-info/controls/more-info-update.ts @@ -47,9 +47,9 @@ class MoreInfoUpdate extends LitElement { return html` ${this.stateObj.attributes.in_progress ? supportsFeature(this.stateObj, UpdateEntityFeature.PROGRESS) && - typeof this.stateObj.attributes.in_progress === "number" + this.stateObj.attributes.update_percentage !== null ? html`` : html`` diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts index a103fb6a9a..cdae8917ed 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts @@ -54,7 +54,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement { const stateObj = this.hass.states[this.updateEntityId]; const progressIsNumeric = - typeof stateObj?.attributes.in_progress === "number"; + typeof stateObj?.attributes.update_percentage !== null; return html`
@@ -69,7 +69,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {

@@ -77,7 +77,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement { ${stateObj.state === "unavailable" ? "Restarting voice assistant" : progressIsNumeric - ? `Installing ${stateObj.attributes.in_progress}%` + ? `Installing ${stateObj.attributes.update_percentage}%` : ""}

`;