Koenkk / Koenkk/zigbee-OTA

SONOFF SWV-ZFU v1.1.0 OTA image fails to parse — "Firmware does not start with expected magic bytes"

Open Beginner friendly
#1,275 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
667
Forks
330
Avg merge
15h 19m
Merged PRs (30d)
31

Description

The SWV-ZFU/ZNE/ZFE/ZNU v1.1.0 OTA image added in #1271 fails to parse in zigpy/ZHA. The download succeeds, but zigpy rejects the file content immediately after fetching it.

Device: SONOFF SWV-ZFU (water valve)
IEEE: a4:c1:38:14:63:61:ff:ff
Manufacturer ID: 4742
Image type: 2062
Current firmware: unknown (device has never successfully reported a version to ZHA)
Setup: Home Assistant + ZHA, zigpy_config.ota.extra_providers set to sonoff and z2m

Steps to reproduce:

  1. Add extra_providers: [sonoff, z2m] under zha.zigpy_config.ota in configuration.yaml
zha:
  zigpy_config:
    ota:
      extra_providers:
        - type: sonoff
        - type: z2m
  1. Restart Home Assistant
  2. Trigger an update check on the update.water_valve_firmware entity (via homeassistant.update_entity)
action: homeassistant.update_entity
data:
  entity_id: update.water_valve_firmware
  1. ZHA finds and attempts to fetch the image from the Z2M provider

Log output:

2026-08-16 21:05:30.460 DEBUG (MainThread) [homeassistant.components.zha.update] Firmware update coordinator data: 0.020 seconds (success: True)
2026-08-16 21:05:30.461 DEBUG (MainThread) [zha.application.platforms] a4:c1:38:14:63:61:ff:ff-1-25-firmware_update: polling current state
2026-08-16 21:05:31.504 DEBUG (MainThread) [zigpy.ota] Failed to download image, ignoring: OtaImageWithMetadata(metadata=RemoteOtaImageMetadata(file_version=4352, manufacturer_id=4742, image_type=2062, changelog=None, checksum='sha512:7fcdc207b28979930d179904fefac18ed1ddbd9ca56098dfa49da5dff46c6f8b1f09cee26634a31705ef0c1e821cb11a07b4604149423a86e45273f863127', file_size=193632, current_file_version=None, model_names=(), changelog=None, release_notes=None, min_hardware_version=None, max_hardware_version=None, specificity=None, source='Remote Z2M provider (https://raw.githubusercontent.com/Koenkk/zigbee-OTA/master/index.json)', url='https://raw.githubusercontent.com/Koenkk/zigbee-OTA/master/images/Sonoff/swv2m_ol1w_v1.1.0.ota'), firmware=None)
ValueError: Firmware does not start with expected magic bytes: firmware[10:]
return firmware = await self.metadata.fetch()
return OTAImage.deserialize(data)

The raw bytes returned start with \x00\xf0\xf4\x02\x00\x01\x0c\xeb\xxb8 instead of the expected Zigbee OTA magic bytes (1E F1 EE 0B). This suggests the uploaded .ota file at images/Sonoff/swv2m_ol1w_v1.1.0.ota may be corrupted, truncated, or not a valid Zigbee OTA container.

Could someone verify the integrity of this specific file against the original SONOFF-provided source?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with images/Sonoff/swv2m_ol1w_v1.1.0.ota and inspect its first bytes, then compare the file with the original SONOFF-provided source. Reproduce the fetch through the configured Z2M provider and confirm that the image parses with the expected Zigbee OTA magic bytes without the reported ValueError.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.