mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 08:47:09 +00:00
Restore latest version of ZHA Update entity
Required for https://github.com/zigpy/zha/pull/460
This commit is contained in:
parent
0cce4d1b81
commit
0040e9e5af
@ -10,13 +10,14 @@ from zha.exceptions import ZHAException
|
|||||||
from zigpy.application import ControllerApplication
|
from zigpy.application import ControllerApplication
|
||||||
|
|
||||||
from homeassistant.components.update import (
|
from homeassistant.components.update import (
|
||||||
|
ATTR_LATEST_VERSION,
|
||||||
UpdateDeviceClass,
|
UpdateDeviceClass,
|
||||||
UpdateEntity,
|
UpdateEntity,
|
||||||
UpdateEntityFeature,
|
UpdateEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, State, callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
@ -195,3 +196,10 @@ class ZHAFirmwareUpdateEntity(
|
|||||||
"""Update the entity."""
|
"""Update the entity."""
|
||||||
await CoordinatorEntity.async_update(self)
|
await CoordinatorEntity.async_update(self)
|
||||||
await super().async_update()
|
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),
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user