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
71.03k stars 29.7k forks source link

No OTA image is available #110447

Closed muzzy124 closed 6 months ago

muzzy124 commented 6 months ago

The problem

In 2024.2.0 ota is somehow broken, I can't update devices with query_next_image command anymore. I haven't changed ZHA YML configuration but ZHA doesn't see updates in otau folder. (the device from the logs is a Xiaomi LYWSD03MMC flashed to custom pvvx's zigbee firmware with ota support. I did update it before via ZHA OTA)

What version of Home Assistant Core has the issue?

2024.2.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

zha

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

zha:
  zigpy_config:
    ota:
      otau_directory: /config/zigpy_ota

Anything in the logs that might be useful for us?

2024-02-13 11:05:44.566 DEBUG (MainThread) [zigpy.zcl] [0xD632:1:0x0019] Decoded ZCL frame: Ota:QueryNextImageCommand(field_control=<FieldControl: 0>, manufacturer_code=4417, image_type=522, current_file_version=18362369)
2024-02-13 11:05:44.567 DEBUG (MainThread) [zigpy.zcl] [0xD632:1:0x0019] Received command 0x01 (TSN 17): QueryNextImageCommand(field_control=<FieldControl: 0>, manufacturer_code=4417, image_type=522, current_file_version=18362369)
2024-02-13 11:05:44.567 DEBUG (MainThread) [zigpy.zcl] [0xD632:1:0x0019] OTA query_next_image handler for 'Xiaomi LYWSD03MMC': field_control=0, manufacturer_id=4417, image_type=522, current_file_version=18362369, hardware_version=None, model='LYWSD03MMC'
2024-02-13 11:05:44.569 DEBUG (MainThread) [zigpy.zcl] [0xD632:1:0x0019] No OTA image is available

Additional information

No response

muzzy124 commented 6 months ago

zha-8c1112f5ba0669c845b05181ee523c84-Xiaomi LYWSD03MMC-c0a7945834fd0c555fdf9ec26988ddc4.json

home-assistant[bot] commented 6 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)

epvuc commented 6 months ago

I am also seeing this problem.

homeassistant  | 2024-02-14 10:15:25.447 DEBUG (MainThread) [zigpy.zcl] [0xB441:1:0x0019] Received command 0x01 (TSN 71): QueryNextImageCommand(field_control=<FieldControl: 0>, manufacturer_code=4655, image_type=257, current_file_version=16908800)
homeassistant  | 2024-02-14 10:15:25.448 DEBUG (MainThread) [zigpy.zcl] [0xB441:1:0x0019] OTA query_next_image handler for 'Inovelli VZM31-SN': field_control=0, manufacturer_id=4655, image_type=257, current_file_version=16908800, hardware_version=None, model='VZM31-SN'
homeassistant  | 2024-02-14 10:15:25.448 DEBUG (MainThread) [zigpy.zcl] [0xB441:1:0x0019] No OTA image is available
homeassistant  | 2024-02-14 10:15:25.449 DEBUG (MainThread) [zigpy.zcl] [0xB441:1:0x0019] Sending reply header: ZCLHeader(frame_control=FrameControl<0x19>(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=False, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=True, *is_general=False), tsn=71, command_id=2, *direction=<Direction.Server_to_Client: 1>)

otau_directory is /config/zigpy_ota and the HACS ZHA toolkit update script's "Enable download" populates it correctly. I added VZM31-SN_2.15.ota into that directory, as well. I will admit I haven't yet figured out how it determines which file from that directory is appropriate as an OTA image for a particular device - is there a magic number in the OTA file or something?

puddly commented 6 months ago

Manually issuing cluster commands like query_next_image and using otau_directory was intended for development purposes, not for general use. ZHA now properly supports OTA for select providers automatically.

To that end, otau_directory has been disabled because of severe incompatibility issues destroying Tuya devices. It will be replaced in the next release with something more robust, deprecating the use of ZHA toolkit for this purpose.

epvuc commented 6 months ago

Ok. For regular updates presumably the current correct method is to just wait to be notified that an update is available? Is there a means of causing a specific image to be sent, for instance if the manufacturer supplies a beta binary?

Fwiw there will be plenty of questions like this, I think, because there are a lot of documents floating around suggesting triggering updates manually via issuing cluster commands - possibly this should be noted prominently in release notes or something.

muzzy124 commented 6 months ago

Hm, if someone puts firmware images to otau folder, he/she should be aware of a risk to destroy tuya or any other device. A firmware update is dangerous in any case. So why we should disable this feature which is very needed for custom devices like in my case? Use z2m instead?

fredrikru commented 6 months ago

Hi

I have problem to update to new firmware on my LYWSD03MMC with firmware 0x01133001. I need to upgrade firmware because I have problem with battery life. I try to update to 1141-0203-11003001-z03mmc.zigbee.

2024-02-17 18:41:37.702 DEBUG (MainThread) [zigpy.zcl] [0x98C3:1:0x0019] OTA query_next_image handler for 'Xiaomi LYWSD03MMC': field_control=0, manufacturer_id=4417, image_type=522, current_file_version=18034689, hardware_version=None, model='LYWSD03MMC' 2024-02-17 18:41:37.723 DEBUG (MainThread) [zigpy.zcl] [0x98C3:1:0x0019] No OTA image is available

puddly commented 6 months ago

Hm, if someone puts firmware images to otau folder, he/she should be aware of a risk to destroy tuya or any other device.

As mentioned above, it's disabled temporarily and will be re-enabled in the next release with many improvements: https://github.com/zigpy/zigpy/pull/1340

muzzy124 commented 6 months ago

at the moment you can "enable" otau folder with:

zha:
  zigpy_config:
    ota:
      allow_file_providers: "I understand I can *destroy* my devices by enabling OTA updates from files. Some OTA updates can be mistakenly applied to the wrong device, breaking it. I am consciously using this at my own risk."
      otau_directory: /config/zigpy_ota