bieniu / ha-shellies-discovery

Script that adds MQTT discovery support for Shellies devices
Apache License 2.0
290 stars 90 forks source link

Firmware detection is wonky and should only suggest a update if the offered firmware is newer than the installed. #590

Closed sebastiannielsen closed 1 month ago

sebastiannielsen commented 1 month ago

Is your feature request related to a problem? Please describe. I have noticed, that the shelly servers sometimes offer a older firmware than the current installed. This causes notifications to be put up to install the firmware, even tough its newest.

Describe the solution you'd like The code should check if the date in the firmware is newer than the installed before requesting it. Couldn't find anywhere in the code where firmware notifications is handled, but basically:

if ( int(substr(installedversion, 0, 8)) < int(substr(latestversion, 0, 8)) ) { alertforfirmwareupdate(device) }

Additional context Current version: 20231107-162940/v1.14.1-rc1-g0617c15 Offered "newer" version: 20230913-112003/v1.14.0-gcb84623 Device: Shelly1

image

bieniu commented 1 month ago

update platform logic in core HA is responsible for comparing firmware versions, not the script code. Versions are compared, not dates, the beta channel version will always be lower than the stable one.

sebastiannielsen commented 1 month ago

aha now I understand. Tought it was your code putting up the notifications and not the core HA code.

bieniu commented 1 month ago

If you use beta firmware you should use update.beta entity.