Fix bug with RainMachine update entity (#78411)

* Fix bug with RainMachine update entity

* Comment
pull/78423/head
Aaron Bach 2022-09-13 16:16:21 -06:00 committed by GitHub
parent 416a5cb279
commit 5501b7e710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -99,4 +99,11 @@ class RainMachineUpdateEntity(RainMachineEntity, UpdateEntity):
UpdateStates.UPGRADING,
UpdateStates.REBOOT,
)
self._attr_latest_version = data["packageDetails"]["newVersion"]
# The RainMachine API docs say that multiple "packages" can be updated, but
# don't give details on what types exist (which makes it impossible to have
# update entities per update type); so, we use the first one (with the idea that
# after it succeeds, the entity will show the next update):
package_details = data["packageDetails"][0]
self._attr_latest_version = package_details["newVersion"]
self._attr_title = package_details["packageName"]