mdeweerd / zha-toolkit

🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant
GNU General Public License v3.0
171 stars 17 forks source link

ZHA toolkit not working for OTA updates #203

Closed corcaioch closed 9 months ago

corcaioch commented 9 months ago

Running HASS on Virtual Box in Windows. Appear to have installed ZHA toolkit successfully, but when try an OTA update of firmware, getting following error:

This error originated from a custom integration.

Logger: custom_components.zha_toolkit.ota Source: custom_components/zha_toolkit/ota.py:188 Integration: 🧰 ZHA Toolkit (documentation, issues)

OTA_notify

mdeweerd commented 9 months ago

That's a false positive.

Sometimes - during development - I change the level of a message to ensure I see it in the logs. Here I had:

    LOGGER.debug("OTA_notify")

just to show that it started the ota_notify service.

I corrected the code, it will be the debug level in a next release.

Thanks for reporting !

corcaioch commented 9 months ago

I'm not sure I fully understand tho, does that mean there's an issue/bug with ZHA toolkit? How do I resolve it, so that I can perform OTA updates.

mdeweerd commented 9 months ago

No that does not mean there is a bug with ZHA toolkit - it was just a message that was reported at the "error level" but it was not an error.

If you want to know what happens during the ota_notify, you need to set the log level to debug.

If the FW is not downloaded yet, you need to request the download by setting "download: true" - then zha_toolkit will download firmware it finds from its sources, mainly Koenk's FW list.

After that it will have zha/zigpy refresh its known FW list.

And then it will send an OTA notification to the device suggesting the device should request a firmware update. Once the device receives that, it will send a paquet back to the ZHA coordinator to request a firmware update. ZHA then checks if it has FW available for this device - as zha_toolkit has triggere a FW list update, ZHA should find the FW if it is in the searched location. If there is FW for the device, the device will get confirmation of it, else ZHA will indicate there is no new firmware.

The debug level for zha-toolkit will "only" show information about the fw download and initial notification. To understand what happens after that, you would need to set a debug level for zha/zigpy.

The following is an example of a service call the sets zha-toolkit, zigpy and zha related log levels to "warning". You could set the zha-toolkit level to debug, as well as zigpy.zcl and zigpy.device.

logger:
  default: warning
  logs:
    custom_components.zha_toolkit: warning
    zigpy_znp.api: warning
    zigpy.zcl: warning
    zigpy_znp.zigbee.application: warning
    zigpy.application: warning
    zigpy.device: warning
    zigpy.util: warning
    zigpy.zdo: warning
    homeassistant.components.zha: warning
    homeassistant.components.zha.core.device: warning