feat: add a warning icon to OTA page for battery devices when battery is too low to safely run an update #2478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the battery of a battery powered device is too low to safely complete a firmware update there's no information on the OTA page.
I've got this same situation with my devices and I did not notice that battery was too low because I went straight to the OTA page.
See my conversation with @Nerivec in #27098.
The icon is shown only when the battery is < 50% or is low or is battery_low.
I wanted to keep the code as much clean as possible so I have implemented a PowerSourceOTA that renders the danger icon.
The icon is not a red battery icon but a red circle with exclamation mark because I did not want to confuse the user with a red battery icon in this page when, for example at 49%, the icon in the device-page is dark grey indicating normal status of the battery.
Hoovering with the mouse over the icon shows a clear explanation message.
I have called the icon rendering at the end of the device line in the OTA page only if :
In all other conditions the icon is not rendered.
The example page looks like this:
@Nerivec @Koenkk @nurikk please review and comment what can be done better or requires more attention on my side.