core: Error while trying to update Reolink doorbell firmware

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.

image

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.

image

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?

[547404851008] 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 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, 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

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (15 by maintainers)

Most upvoted comments

@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

@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.

This has been fixed by introducing firmware upload functionality in Reolink integration in HA 2024.11.2. Thank you @starkillerOG!

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.

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.

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.

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.