aioshelly
aioshelly copied to clipboard
Get firmware info from Shelly update server
Retrieve the firmware version ( es. "20231219-133948/1.1.0-g34b5d4f") from the official URLs verified with Shelly.
This info will be used only to inform the users that a new version is available. Code doesn't retrieve any URL so no action can be performed on the device.
I am also against having this functionality in aioshelly. Albeit rare, devices may require specific upgrade paths for some older versions. If the wrong firmware is flashed on a device it may brick. Our update server gets identifying bits from the devices when they ask for new versions and takes the necessary steps for flashing intermediate versions.
We are discussing adding a public repository with stable and previous stable releases, but what you have now is not it.
Albeit rare, devices may require specific upgrade paths for some older versions. If the wrong firmware is flashed on a device it may brick. Our update server gets identifying bits from the devices when they ask for new versions and takes the necessary steps for flashing intermediate versions.
@kzyapkov , this PR is not about flashing the firmware, but only retrieve the information of the latest available (thus the title). Is in charge to the user to flash it.
On the other hand, take care that we have a update firmware button in HA that will flash latest. This functionality is there since ages. So far, AFAIK, we didn't had a single report of a issue.
We are discussing adding a public repository with stable and previous stable releases, but what you have now is not it.
Nice! Thx.
On the other hand, take care that we have a update firmware button in HA that will flash latest. This functionality is there since ages. So far, AFAIK, we didn't had a single report of a issue.
As I already tried to explain on discord (which you try to ignore) when we ask the device to trigger an update we are not providing the firmware URL. We just trigger update to latest which is the same as the update button on the device web, the firmware URL is reported to the device based on multiple factors as @kzyapkov explained above.
I still insist we shouldn't provide any URL to the user, a simple example is Shelly RGBW2 which if uses the URL provided by this design will flash an incorrect firmware to the device (I can explain you the specific logic for this devices, but I don't know what is the logic in all devices), this is just one example and I am not sure how this will work for the entire install base and if there are other devices that can break.
You could let devices fetch update info -- call Shelly.CheckForUpdate
@thecode, please check the code. It DOESN'T fetch any url at all. It just retrieve the firmware build string, nothing else.
You could let devices fetch update info -- call Shelly.CheckForUpdate
The issue is linked to misconfigured devices that don't have internet access and don't notify the user of a new available firmware. The idea is just to make them aware a new version exist. But no action at all will ever be performed.
@thecode, @kzyapkov, sorry for the imprecision: I just noticed that I wrote "button" instead of "service".
What I wanted to focus is that we have a service in HA that can be used to flash device providing a URL to the OTA endpoint. If this can brick the device, we should that avoid the possibility to use custom URLs.
What I wanted to focus is that we have a service in HA that can be used to flash device providing a URL to the OTA endpoint.
There is url
parameter in aioshelly
for gen1 devices but we don't use it in the integration. So we only run the API methods to start an OTA update.
https://github.com/home-assistant/core/blob/83e0a7528d8052005c338530ceb430e52e3ce08a/homeassistant/components/shelly/update.py#L212
https://github.com/home-assistant/core/blob/83e0a7528d8052005c338530ceb430e52e3ce08a/homeassistant/components/shelly/update.py#L297
What I wanted to focus is that we have a service in HA that can be used to flash device providing a URL to the OTA endpoint.
There is
url
parameter inaioshelly
for gen1 devices but we don't use it in the integration. So we only run the API methods to start an OTA update.
Yes, if you look at the trigger_ota_update(), but the service itself allows the url parameter in its call. This means that a user can specify a custom url for update.
As this can in rare cases be a issue as @kzyapkov wrote, I just wanted to point it out.
but the service itself allows the url parameter in its call
Which service?
I still think this simple notification (no action at all) could be very useful for all users that are not notified of a new firmware for whatever reason.
But Team decided not to go this way, so I close this PR.