From 0040e9e5afe7a39d8d463c0e9c4aa87183ad4169 Mon Sep 17 00:00:00 2001 From: abmantis Date: Mon, 9 Jun 2025 18:01:57 +0100 Subject: [PATCH] Restore latest version of ZHA Update entity Required for https://github.com/zigpy/zha/pull/460 --- homeassistant/components/zha/update.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zha/update.py b/homeassistant/components/zha/update.py index 062581fd259..90a7b860674 100644 --- a/homeassistant/components/zha/update.py +++ b/homeassistant/components/zha/update.py @@ -10,13 +10,14 @@ from zha.exceptions import ZHAException from zigpy.application import ControllerApplication from homeassistant.components.update import ( + ATTR_LATEST_VERSION, UpdateDeviceClass, UpdateEntity, UpdateEntityFeature, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform -from homeassistant.core import HomeAssistant +from homeassistant.core import HomeAssistant, State, callback from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -195,3 +196,10 @@ class ZHAFirmwareUpdateEntity( """Update the entity.""" await CoordinatorEntity.async_update(self) await super().async_update() + + @callback + def restore_external_state_attributes(self, state: State) -> None: + """Restore entity state.""" + self.entity_data.entity.restore_external_state_attributes( + latest_version=state.attributes.get(ATTR_LATEST_VERSION), + )