home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.15k stars 31.13k forks source link

ZHA - New 'Firmware update' feature not working (on IKEA device) #110103

Closed marcelkous closed 3 months ago

marcelkous commented 9 months ago

The problem

The ZHA notified me of a firmware update of an IKEA TRADFRI Signal Repeater. Greenshot 2024-02-09 13 05 16

When pressing the install button the upd Greenshot 2024-02-09 12 26 04 ate process starts.

After several minutes the update is finished and it shows as Up-to-date. Greenshot 2024-02-09 12 26 01

But a few minutes later it is detected again as an older version.

Greenshot 2024-02-09 12 25 55

I have tried to update several times, but every time, I have the same result... It finishes, says Up-to-date, and then comes back. I have even changed my wifi configuration so it doesn't use WiFi 2.4 channel 1 because that overlaps with Zigbee Channel 11 (that's where I'm at), and tried again. (I saw a log entry about this, but never had any issues with ZHA)

What version of Home Assistant Core has the issue?

2024.2.1

What was the last working version of Home Assistant Core?

n/a

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ZHA

Link to integration documentation on our website

No response

Diagnostics information

config_entry-zha-094c7a58bd164d31a32dba53f35bc488.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: zigpy.application
Source: components/zha/core/gateway.py:214
First occurred: 1:21:01 PM (2 occurrences)
Last logged: 1:21:01 PM

Zigbee channel 11 utilization is 89.94%!
If you are having problems joining new devices, are missing sensor updates, or have issues keeping devices joined, ensure your coordinator is away from interference sources such as USB 3.0 devices, SSDs, WiFi routers, etc.

********* WiFi Config changed after this ***********
Wifi APs do not use channel 1 any more.

Additional information

No response

home-assistant[bot] commented 9 months ago

Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zha` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zha` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zha documentation zha source (message by IssueLinks)

sven-debug commented 9 months ago

I have also problems updating my IKEA stuff. I can provide as much documentation as you need. Your support would be highly appreciated!

pixelspark commented 9 months ago

Seeing something similar here, if useful I can also gather some more information.

image

r0bb10 commented 9 months ago

Same here.

image

Logs:


Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 12:29:31 (1 occurrences)
Last logged: 12:29:31

[546629601728] Update was not successful - result: <Status.FAILURE: 1>
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/zha/update.py", line 177, in async_install
    raise HomeAssistantError(f"Update was not successful - result: {results}")
homeassistant.exceptions.HomeAssistantError: Update was not successful - result: <Status.FAILURE: 1>
johnkjellberg commented 9 months ago

Seeing something similar here, if useful I can also gather some more information.

image

For me, this can usually be fixed by clicking a button directly after hitting the "Install" (for walking up battery powered devices). It fails later at random percentages though.

Kriss1670 commented 8 months ago

I have the same issue with some switches from NodOn). Reminder keeps popping up but each time got an error from update service.

johnkjellberg commented 8 months ago

I got it working now by keeping the IKEA button at a couple of meters away from my IKEA lamp and do the upgrade. If I keep it very close to the lamp it doesn't work, and keeping it close to the Zigbee dongle doesn't work either.

r0bb10 commented 8 months ago

image

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 09:31:29 (2 occurrences)
Last logged: 09:35:28

[547955906496] Update was not successful: <Status.FAILURE: 1>
[547862043456] Update was not successful: <Status.FAILURE: 1>
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/zha/update.py", line 198, in async_install
    raise HomeAssistantError(f"Update was not successful: {result}")
homeassistant.exceptions.HomeAssistantError: Update was not successful: <Status.FAILURE: 1>

No way it works :(

home-assistant_zha_2024-03-20T08-35-41.521Z.log

jjaammhh commented 8 months ago

Suffering the same here. A notification of a Styrbar (Ikea N2) is shown at the main control panel, but after progressing at a speed around one percent every 5 minutes, it fails at above 15 or 16 percent.

I must add, I successfully upgraded another Stybar switches in past issuing an image_notify Zigbee command from the Zigbee configuration panel of the device, in Home Assistant. But now even such hardcore method seems to fail.

puddly commented 8 months ago

If your update fails part way through, please enable ZHA debug logging before starting the update, let it run, then disable debug logging after it fails. Upload the debug log here. You may need to zip it first if it's too big.

jjaammhh commented 8 months ago

Thanks for your interest. Attached is my log 2024-03-24 175124.378 DEBUG (MainTh.log.zip And now an extended one home-assistant_zha_2024-03-24T16-56-00.794Z.zip

marcinwasilewski commented 8 months ago

For me, this can usually be fixed by clicking a button directly after hitting the "Install" (for walking up battery powered devices). It fails later at random percentages though.

Thank you for this! Can confirm that I was able to update my TRADFRI open/close remote by clicking the button on the remote during install. Previously it resulted in "<Status: FAILURE: 1>". The update took some time but the notification has finally disappeared

tuct commented 8 months ago

Hitting the button also worked for me! Update still running ;) Without, my logs looked liked the ones from @jjaammhh

HannesVo commented 8 months ago

Just updated an Tradfri Motion sensor with continuous motion while updating....worked for me... Report for an Shorcut button will come today evening.

marcelkous commented 8 months ago

My device isn't battery-powered. So I don't have to wake it up... image

It starts, it finishes 'successful' but the, few seconds later just report not updated and I can start from scratch... I'm doing an upgrade right now with debugging enabled...will upload the debug file when 'finished'

home-assistant_zha_2024-04-02T10-06-20.322Z.log.zip

marcinwasilewski commented 8 months ago

My device isn't battery-powered. So I don't have to wake it up... It starts, it finishes 'successful' but the, few seconds later just report not updated and I can start from scratch... I'm doing an upgrade right now with debugging enabled...will upload the debug file when 'finished'

I would try power cycle it, and wait a couple of hours and/or re-add it to zha.

marcelkous commented 8 months ago

My device isn't battery-powered. So I don't have to wake it up... It starts, it finishes 'successful' but the, few seconds later just report not updated and I can start from scratch... I'm doing an upgrade right now with debugging enabled...will upload the debug file when 'finished'

I would try power cycle it, and wait a couple of hours and/or re-add it to zha.

Did the power-cycle several times...

Edit: Haven't Tried to re-add yet, can do tonight, no difference.

pzucchel commented 8 months ago

I have exactly the same problem, with 22 ikea lights. Home assistant 2024.4

532910 commented 7 months ago

zigbee2mqtt also doesn't work for such devices, but I found a workaround:

  1. remove all batteries from zigbee device
  2. insert the battery
  3. with no delay press update
  4. goto 1 on failure

this works for me for zha and zigbee2mqtt

adimosh commented 7 months ago

zigbee2mqtt also doesn't work for such devices, but I found a workaround:

  1. remove all batteries from zigbee device
  2. insert the battery
  3. with no delay press update
  4. goto 1 on failure

this works for me for zha and zigbee2mqtt

Well this would be absolutely stupid, especially if it were to actually work reliably. I cannot really understand why power-cycling the device would even be necessary, but alas, I tried it with an Ikea shortcut button. The result was that the update started, went all the way to 100%, then failed.

By the way, I also tried to check something specific to Ikea devices: I set an alarm on my watch every two minutes to remind me to push the button, thus keeping the device alive. I did notice before, when I started trying to update shortcut buttons, that after I would not give them attention during the update process, it would fail after a few minutes. So I decided to do everything in my power to keep them alive, thinking that Ikea devices are just dumb like that, and can't figure out on their own that they need to keep themselves alive in order to receive an update. The result, however, was the same: it went all the way to 100%, and then reported failure.

The same also applies if I keep them awake from Home Assistant every two minutes.

puddly commented 7 months ago

@marcelkous I've annotated a portion of your log:

# Device has successfully finished its upgrade to 0x23086631
2024-04-02 12:04:52.587 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Decoded ZCL frame: Ota:upgrade_end(status=<Status.SUCCESS: 0>, manufacturer_code=4476, image_type=4354, file_version=587753009)

# We tell the device to reboot
2024-04-02 12:04:52.591 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Sending reply: upgrade_end_response(manufacturer_code=4476, image_type=4354, file_version=587753009, current_time=0, upgrade_time=0)

# The device does and is back on the network about 5s later
2024-04-02 12:04:57.415 INFO (MainThread) [zigpy.application] Device 0xdd77 (68:0a:e2:ff:fe:ec:4f:b3) joined the network

# We read its current firmware version
2024-04-02 12:05:02.745 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Sending request: Read_Attributes(attribute_ids=[2])

# And the device responds with 0x23070631, the old version!
2024-04-02 12:05:02.942 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Decoded ZCL frame: Ota:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0002, status=<Status.SUCCESS: 0>, value=TypeValue(type=uint32_t, value=587662897))])

What is the device currently showing as its firmware version?

marcelkous commented 7 months ago

@marcelkous I've annotated a portion of your log:

# Device has successfully finished its upgrade to 0x23086631
2024-04-02 12:04:52.587 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Decoded ZCL frame: Ota:upgrade_end(status=<Status.SUCCESS: 0>, manufacturer_code=4476, image_type=4354, file_version=587753009)

# We tell the device to reboot
2024-04-02 12:04:52.591 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Sending reply: upgrade_end_response(manufacturer_code=4476, image_type=4354, file_version=587753009, current_time=0, upgrade_time=0)

# The device does and is back on the network about 5s later
2024-04-02 12:04:57.415 INFO (MainThread) [zigpy.application] Device 0xdd77 (68:0a:e2:ff:fe:ec:4f:b3) joined the network

# We read its current firmware version
2024-04-02 12:05:02.745 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Sending request: Read_Attributes(attribute_ids=[2])

# And the device responds with 0x23070631, the old version!
2024-04-02 12:05:02.942 DEBUG (MainThread) [zigpy.zcl] [0xDD77:1:0x0019] Decoded ZCL frame: Ota:Read_Attributes_rsp(status_records=[ReadAttributeRecord(attrid=0x0002, status=<Status.SUCCESS: 0>, value=TypeValue(type=uint32_t, value=587662897))])

What is the device currently showing as its firmware version?

This is indeed what I also see happening in the GUI. Start upgrade --> Upgrade finished --> restart --> again ready for upgrade (this will loop endlessly) 🤷‍♂️

The current firmware shows:
image

image

I've unplugged the devices, relocated the device (closer to the Zigbee radio module), re-joined the device... nothing did help. I use the SONOFF ZBBridge – Smart Zigbee Bridge (I know it is not recommended but I have had no issue with this WiFi to Zigbee Bridge so far)

brgerig commented 7 months ago

Any updates to this? I'm having exactly the same problem with a Tradfri Signal repeater, also going from version 0x23070631 to 0x23086631. I'm running ZHA in Home Assistant Core 2024.4.2.

Jumperm commented 7 months ago

Same for my Motion Sensor E1745 var2.

Bildschirmfoto 2024-04-19 um 21 02 52

Any solution process or what logs do you need?!

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/websocket_api/commands.py:239
Integration: Home Assistant WebSocket API (Dokumentation, Probleme)
Erstmals aufgetreten: 14:46:58 (6 Vorkommnisse)
Zuletzt protokolliert: 18:55:53

[140490895667264] Update was not successful: <Status.FAILURE: 1>
[140490786089664] Update was not successful: <Status.FAILURE: 1>
[140490709868736] Update was not successful: <Status.FAILURE: 1>
[140490736952000] Update was not successful: <Status.FAILURE: 1>
[140490738371264] Update was not successful: <Status.FAILURE: 1>
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 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/update/__init__.py", line 162, in async_install
    await entity.async_install_with_progress(version, backup)
  File "/usr/src/homeassistant/homeassistant/components/update/__init__.py", line 466, in async_install_with_progress
    await self.async_install(version, backup)
  File "/usr/src/homeassistant/homeassistant/components/zha/update.py", line 196, in async_install
    raise HomeAssistantError(f"Update was not successful: {result}")
homeassistant.exceptions.HomeAssistantError: Update was not successful: <Status.FAILURE: 1>
Jumperm commented 7 months ago

My Update work after keeping it awake by pressing the button.

Kriss1670 commented 7 months ago

My devices do not need to be awake as they are always connected and active (Nodon switches). I switched one of them from ZHA to Z2M and update worked properly. This tends to confirm that the problem is from ZHA, not from the device.

puddly commented 7 months ago

Updates are initiated by the device and the device asks for individual pieces of firmware. It's not driven by ZHA. If an update halts, it is because the device stopped asking for firmware pieces.

Z2M forces you to channel 11 by default, while ZHA generally avoids it. There are many factors beyond the software itself (channel being the main one, though network topology is also important).

Kriss1670 commented 7 months ago

Thanks for the « under the hood » explanation. From the user point of view, it works under Z2M and doesn’t under ZHA. I will try again.

JanNJNS commented 6 months ago

I have the same problem. Error message: Update was not successful: <Status.FAILURE: 1>

coldburn89 commented 5 months ago

Still the same issue here

DarthSonic commented 5 months ago

Struggling with the same issue since weeks. Previously it worked for several devices of the same type (ikea tradfri motion sensor). Don't exactly know when it stopped working.

coldburn89 commented 5 months ago

Yesterday evening (when all the bulbs were on) I started the updates and surprisingly they updated successfully. Some of them I needed to retry a few times but it worked. Maybe this helps :)

On Tue, 11 Jun 2024 at 08:35, Sven @.***> wrote:

Struggling with the same issue since weeks. Previously it worked for several devices of the same type (ikea tradfri motion sensor). Don't exactly know when it stopped working.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/110103#issuecomment-2159906728, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYS5HXMTAR5DP2IRQGR7WI3ZG2LETAVCNFSM6AAAAABDBOY4AKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJZHEYDMNZSHA . You are receiving this because you commented.Message ID: @.***>

DarthSonic commented 5 months ago

I was able to start the update (progressbar) by "wakening" the device some times before and after starting install of update. But after some hours (!) it suddenly aborted at 73% completion.

SchulieBug commented 5 months ago

I'm running the update now, almost an hour now and at 46% for a Ikea button. It takes ages, will see tomorrow (hopefully with a successful update)

indomitorum commented 4 months ago

Must be a bug as we are in August 2024 and the issue persists - in my case, exactly same cases as above either failing to initiate (have to press a button to initiate) and then fails after a random %. IKEA N2.

Hopefuly it can be fixed.

Update: A workaround is to press a button so it initiates and then to keep pressing a button every 5min or it will fail. Certainly not ideal but some way to get it updated since I have been trying for months

3oris commented 3 months ago

Same issue here Error message: Update was not successful: <Status.FAILURE: 1>

andipilz commented 3 months ago

Same issue here, but with the question: For the TRADFRI Motion Sensor which would be the button to press from time to time? I tried the bright/dark and link and the third one. No result and still error "1". I also tried a regular "motion" input, but that didn't help either. I managed the update with button presses for the shade button TRADFRI open/close remote and some of the Remote Control N2 but not all... Frustrating ,-(

Kriss1670 commented 3 months ago

Switched to Z2M. Regret to have to do this but it solved all my problems.

DarthSonic commented 3 months ago

I added dedicated Zigbee Repeater to my network. No issues since then and firmware is updating smoothly.

puddly commented 3 months ago

I think this issue can be closed. As mentioned above, updates are initiated by the device and the device asks for individual pieces of firmware. It's not driven by ZHA. If an update halts, it is because the device stopped asking for firmware pieces. This means the update will fail if your network cannot successfully send ~10k Zigbee messages with 100% reliability.

Unfortunately, there is little that ZHA can do about this. Making your network more reliable and reducing interference will help.

DarthSonic commented 3 months ago

For all that are interested, I am using a single Aeotec Range Extender for each floor of my house.

Kriss1670 commented 3 months ago

I added dedicated Zigbee Repeater to my network. No issues since then and firmware is updating smoothly.

Tried this… without success.

Kriss1670 commented 3 months ago

I regret this issue is closed as it is surely a real problem. This tends to push ZHA users to other integrations.

adimosh commented 3 months ago

I think this issue can be closed. As mentioned above, updates are initiated by the device and the device asks for individual pieces of firmware. It's not driven by ZHA. If an update halts, it is because the device stopped asking for firmware pieces. This means the update will fail if your network cannot successfully send ~10k Zigbee messages with 100% reliability.

Unfortunately, there is little that ZHA can do about this. Making your network more reliable and reducing interference will help.

I am not certain how ZHA integration can do nothing about this, since it has also been mentioned above that Z2MQTT seems to have no trouble whatsoever with these devices.

Now, granted, this appears to be particular to Ikea battery-powered devices - which have to be kept awake manually for the update to not stall. Since they do actually successfully update using their own bridge (something which I have experimented with before), the issue is clearly not with the device itself.

Could there be an investigation as to why it happens with them? Ikea devices are cheap and, from what I can tell, popular.

marcelkous commented 3 months ago

I don't understand the closure either. My device, an IKEA Repeater that is powered through main power (not a battery) is still popping up.... updating, and ... coming back... 🤷‍♂️

Kriss1670 commented 3 months ago

So why does it work with Z2M ?And why the device still requests update and ZHA sends an error message stating that update has failed ?Le 29 août 2024 à 10:45, Adrian Mos @.***> a écrit :

I think this issue can be closed. As mentioned above, updates are initiated by the device and the device asks for individual pieces of firmware. It's not driven by ZHA. If an update halts, it is because the device stopped asking for firmware pieces. This means the update will fail if your network cannot successfully send ~10k Zigbee messages with 100% reliability. Unfortunately, there is little that ZHA can do about this. Making your network more reliable and reducing interference will help.

I am not certain how ZHA integration can do nothing about this, since it has also been mentioned above that Z2MQTT seems to have no trouble whatsoever with these devices. Now, granted, this appears to be particular to Ikea battery-powered devices - which have to be kept awake manually for the update to not stall. Since they do actually successfully update using their own bridge (something which I have experimented with before), the issue is clearly not with the device itself. Could there be an investigation as to why it happens with them? Ikea devices are cheap and, from what I can tell, popular.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

FilTrCZ commented 2 months ago

Hi, I was dealing with the same problem. It took me a few days to find out that the device that had a problem with the firmware update is connected to HomeAssitant through another device. So I had to physically disconnect the device that was in the way to connect the firmware updater directly to the gateway. After that, the update mostly went without a problem. In my case I was trying to update the FW in a button that was connected to the HA via a bulb that made the button a repeater on the route. I turned off the light switch and waited a while. After that, the button connected directly to HA and the FW update went OK.