Fix ZHA update entity not updating installed version (#109260)

This commit is contained in:
TheJulianJES 2024-02-01 08:26:39 +01:00 committed by GitHub
parent 5c3bf13ca4
commit c355dd77a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -122,6 +122,7 @@ class ZHAFirmwareUpdateEntity(ZhaEntity, UpdateEntity):
self._latest_version_firmware = image
self._attr_latest_version = f"0x{image.header.file_version:08x}"
self._image_type = image.header.image_type
self._attr_installed_version = self.determine_installed_version()
self.async_write_ha_state()
@callback

View File

@ -108,12 +108,18 @@ async def setup_test_data(
return zha_device, cluster, fw_image, installed_fw_version
@pytest.mark.parametrize("initial_version_unknown", (False, True))
async def test_firmware_update_notification_from_zigpy(
hass: HomeAssistant, zha_device_joined_restored, zigpy_device
hass: HomeAssistant,
zha_device_joined_restored,
zigpy_device,
initial_version_unknown,
) -> None:
"""Test ZHA update platform - firmware update notification."""
zha_device, cluster, fw_image, installed_fw_version = await setup_test_data(
zha_device_joined_restored, zigpy_device
zha_device_joined_restored,
zigpy_device,
skip_attribute_plugs=initial_version_unknown,
)
entity_id = find_entity_id(Platform.UPDATE, zha_device, hass)