Open gralin opened 7 months ago
Hey there @starkillerog, mind taking a look at this issue as it has been labeled with an integration (reolink
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
reolink documentation reolink source (message by IssueLinks)
It seems that Reolink Doorbell doesn't support UpgradeOnline
command. I manually updated my doorbell firmware to some archive versions and each time the response is the same - error "same version". Also, when I call CheckFirmware
for each firmware, the response is always "newFirmware" : 0
.
For better UX, maybe we could hide the install option when showing the message about new firmware for Reolink Doorbell? Second option would be to download the firmware and use UpgradePrepare
and Upgrade
commands, which would require splitting the firmware file into chunks and sending it to the device. Would such approach be accepted by HA team? The API is documented.
@gralin the doorbell does support online updates, however the implementation sucks. Often the online update does not find the new version available, while reolink did upload a new version in their download center.
So the Reolink integration checks both the API of the doorbell to see if a firmware version is available But also directly checks the Reolink json server on the internet to see if there is a new firmware version. (In some cases the API update check does find a update which has not been uploaded to the reolink download center yet).
In case the doorbell API does not find a update while their is one available on the internet json server of reolink, the install button will fail as you described.
If you hide the install button, their will also not be an notification in HomeAssistant.... I really do not like that, because then users won't notice their is an update.
So definetely the best option would be to download the zip file with the new firmware from the reolink json server on the internet.
Extract the zip file, and then upload the new firmware using the UpgradePrepare
and Update
commands.
I would very much be open to a PR on the reolink-aio library and then on HomeAssistant to implement this.
However i did not implement this yet because I am very afraid I could do something wrong during the update process and brick the camera. Since their are many many users of this integration, if I make a mistake, potentially a mountain off cams of users could be bricked during update. That would be a nightmare. So this would need really thourough testing!
@starkillerOG Thanks for your feedback! So we should try to support uploading firmware to the device. I agree that this is a risky process and we should take every possible precaution. As a first step, I emailed Reolink support asking what safety measures they take to prevent damage to the device. I hope they at least check the integrity of the firmware, in case the split and transfer process would contain any bugs. It would also be good if they checked the validity of the firmware to prevent switching to a version for another model.
Same problem, HA shows me Update today and Update is from 29feb
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 21:07:23 (4 occurrences)
Last logged: 21:07:42
[140717387669312] Error trying to update Reolink firmware: cmd 'UpgradeOnline': API returned error code 1, response code -30/same version
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/reolink/update.py", line 101, in async_install
await self._host.api.update_firmware()
File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 1990, in update_firmware
await self.send_setting(body)
File "/usr/local/lib/python3.12/site-packages/reolink_aio/api.py", line 3918, in send_setting
raise ApiError(f"cmd '{command}': API returned error code {json_data[0]['code']}, response code {rspCode}/{detail}")
reolink_aio.exceptions.ApiError: cmd 'UpgradeOnline': API returned error code 1, response code -30/same version
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/update/__init__.py", line 161, in async_install
await entity.async_install_with_progress(version, backup)
File "/usr/src/homeassistant/homeassistant/components/update/__init__.py", line 465, in async_install_with_progress
await self.async_install(version, backup)
File "/usr/src/homeassistant/homeassistant/components/reolink/update.py", line 103, in async_install
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error trying to update Reolink firmware: cmd 'UpgradeOnline': API returned error code 1, response code -30/same version
in Reolink APP i don't see new Update WTF
@gralin thanks for contacting reolink, seems like a good plan! Are you a developer and able to write a PR for the firmware update upload?
@starkillerOG I am proficient in C# but looking for some motivating project to learn Python, so this just might be it, unless someone beats me to it ;)
My support case got escalated by Reolink and I received this confirmation
Regarding the update, as long as the camera is not accidentally powered off when upgrading is in processing, it will not go brick. Please rest assured.
So it seems that the implementation and use of the update API should be safe. Even if we screw up something (upload the wrong firmware or incorrect bytes), in the worst case, the update will fail and the notification in Home Assistant will not disappear.
Nice, I think the first thing to do would be to write some code to upload the firmware file to the camera using aiohttp. I think the firmware file needs to be uploaded in chunks, I am actually not entirely sure how to do that with aiohttp, but pretty sure it is possible. Would you be willing to work on that @gralin
I think we will need the aiohttp.MultipartWriter, which I have not used before.... I think most of what we need is documented here: https://docs.aiohttp.org/en/stable/multipart.html#sending-multipart-requests
@starkillerOG yes, I will give it a try, but it will take a while before I open a PR 🙈 I will keep you posted about my progress
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
@gralin something new?
This is still an issue.. on all of my cameras. Not just the doorbell. When you go to the camera's web interface and click check for updates, it doesn't show any available updates until you actually upload the file.
I know, at some point I will implement directly uploading the zip file, but that is quite a complex process so it will take a while before I take on that project.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Actually have been working in this the past week and this whole day.
I have direct firmware uploading working on my dev environment, so thus will likely be included in the HA 2024.11.0 release in a month.
Code is ready for testing by brave people: https://github.com/home-assistant/core/pull/127007 TESTING THIS NEW CODE IS AT YOUR OWN RISK
I have done 10+ firmware updates on 4 diffrent models without issues, but I can not give garantees.
The problem
I received a notification about new firmware being available for my Reolink doorbell, but when I try to install it from within Home Assistant, it result in and error.
I double checked the doorbell current firmware version and indeed its the older version and an upgrade should be possible. I will try to investigate what is the exact API call and API response to try to undertand which side is to be blamed here.
What version of Home Assistant Core has the issue?
core-2024.2.5
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
reolink
Link to integration documentation on our website
https://www.home-assistant.io/integrations/reolink
Diagnostics information
config_entry-reolink-dfe30bfca75c10d1eaee3c92c4fbcb19.json
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response