Fix zwave_js firmware update logic (#101143)

* Fix zwave_js firmware update logic

* add comment

* tweak implementation for ssame outcome
pull/101386/head
Raman Gupta 2023-09-29 23:05:33 -04:00 committed by Franck Nijhof
parent af041d2900
commit 01182e8a5c
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 26 additions and 4 deletions

View File

@ -211,11 +211,15 @@ class ZWaveNodeFirmwareUpdate(UpdateEntity):
return
try:
available_firmware_updates = (
await self.driver.controller.async_get_available_firmware_updates(
self.node, API_KEY_FIRMWARE_UPDATE_SERVICE
# Retrieve all firmware updates including non-stable ones but filter
# non-stable channels out
available_firmware_updates = [
update
for update in await self.driver.controller.async_get_available_firmware_updates(
self.node, API_KEY_FIRMWARE_UPDATE_SERVICE, True
)
)
if update.channel == "stable"
]
except FailedZWaveCommand as err:
LOGGER.debug(
"Failed to get firmware updates for node %s: %s",

View File

@ -87,6 +87,24 @@ FIRMWARE_UPDATES = {
"rfRegion": 1,
},
},
# This firmware update should never show because it's in the beta channel
{
"version": "999.999.999",
"changelog": "blah 3",
"channel": "beta",
"files": [
{"target": 0, "url": "https://example3.com", "integrity": "sha3"}
],
"downgrade": True,
"normalizedVersion": "999.999.999",
"device": {
"manufacturerId": 1,
"productType": 2,
"productId": 3,
"firmwareVersion": "0.4.4",
"rfRegion": 1,
},
},
]
}