Generate OTA file

Hi,

I'm really sorry but I can't figure out how to do this.  I've added FOTA to my ZigBee project (using the light switch example) but I can't find anything on how to generate an *.ota file that I can use to do the update via ZigBee2MQTT.

Am I able to do this on the NRF52840? Is there any documentation on this? I feel like I've been looking for too long and have subject blindness.

Thank you

Parents
  • Hello,

    What kind of bootloader do you have? And what SDK version are you using?  Based on your other tickets, it looks like you are using NCS. So if you have added a bootloader to your application, then your build folder should include the ota file.

    The file is located in build\zephyr\dfu_update.zip, and is called app_update.bin.

    However, this bootloader is not tailored for Zigbee, so where you would typically use something called mcumgr for performing the FOTA via bluetooth or serial, mcumgr doesn't do zigbee. As you can see here, we are currently using a tool called nrfutil to generate the ota image. 

    What I am not sure of, however, is how to transfer this file over ZigBee2MQTT (Z2M). Is this some sort of Home Assistance thing, by chance? In our guides, we use nrfutil with an additional DK to transfer the image to the OTA target, but I am not sure whether this will work with Z2M. You will have to test that. 

    Best regards,

    Edvin

  • Hi Edvin,

    I'm using MCUBoot and v2.5.2 of the SDK.

    I found app_update.bin Thursday evening after submitting this ticket and was wondering if that would be it.

    Yes, ZigBee2MQTT is a Home Assistant thing.  I've been pulling my hair out trying to figure out how to do both the NRF side of things and the Z2M side of things.

    I'll give this all another read with fresh Monday eyes and report back.

    Thank you

  • I see. Z2M is not something that we support directly, but I believe we have other users (perhaps you, included), who has tried before. Not sure of the outcome, though. Also, not sure if anyone have (successfully) tried FOTA using Z2M. 

    The app_update.bin is at least the binary format of the application. You should also find something like merged.hex in there, which is the .hex representation. What I am not sure of, however, is how the transport would work in Z2M. By default it is expected to use it's own Zigbee cluster for transporting the new image, when you are using MCUBOOT. Not sure how this is done in Z2M.

    Best regards,

    Edvin

  • Hi Edvin,

    I've been playing around today and it looks like Z2M does successfully update my board.  I found that building my project also gave me a *.zigbee image which I uploaded to Home Assistant and I was able to successfully update my board from the Z2M add-on.

    Thank you very much for your help.

Reply Children
  • Hello,

    Wow, that,s actually really cool! I guess the DFU protocol for Zigbee is standardized, so it kind of makes sense, but I wouldn't expect it to work so easily out of the box. 

    Thanks for sharing!

    Best regards,

    Edvin

  • Hi alyssiarosewhite,
    I've been experimenting with Zigbee2MQTT but haven’t had any success with OTA updates. Could you please share what changes you made to get OTA working on your Nordic board?

  • I’ve been experimenting with Zigbee2MQTT and the nRF52840 board to perform OTA updates, but I haven’t been successful so far. I created a custom external converter for the nRF52840, added it as a supported device, and generated the my_index.json file — however, the OTA update still doesn’t work. I’ve attached all the necessary details. I created 127F-0141-02000000-light_bulb.zigbee file but this file is not visible in Zigbee2Mqtt OTA firmware update page. please help me troubleshoot this issue.

    External converter

    import * as m from 'zigbee-herdsman-converters/lib/modernExtend';

    console.log(">>> Loading external converter for Dimable_Light_v01");

    export default {
    zigbeeModel: ["Dimable_Light_v01"],
    model: "Dimable_Light_v01",
    vendor: "Nordic",
    description: "Automatically generated definition",
    extend: [m.deviceEndpoints({"endpoints":{"5":5,"10":10}}), m.light()],
    meta: {"multiEndpoint":true},
    };

    my_index.json
    [
    {
    "url": "/ota/127F-0141-02000000-light_bulb.zigbee",
    "imageType": 321,
    "manufactureCode": 4735,
    "fileVersion": 16777216,
    "force": true
    }
    ]

    configuration.yaml
    version: 4
    mqtt:
    base_topic: zigbee2mqtt
    server: mqtt://localhost:1883
    serial:
    port: COM18
    adapter: zboss
    baudrate: 115200
    rtscts: false
    external_converters:
    - >-
    C:/Users/nagarajan.m/Downloads/zigbee2mqtt-master/zigbee2mqtt-master/data/external_converters/Dimable_Light_v01.mjs
    advanced:
    log_level: info
    channel: 16
    network_key:
    - 192
    - 99
    - 61
    - 57
    - 226
    - 129
    - 254
    - 190
    - 202
    - 191
    - 105
    - 202
    - 14
    - 55
    - 40
    - 50
    pan_id: 23150
    ext_pan_id:
    - 71
    - 227
    - 191
    - 250
    - 103
    - 23
    - 180
    - 99
    frontend:
    enabled: true
    port: 8080
    homeassistant:
    enabled: false
    ota:
    update_check_interval: 1440
    disable_automatic_update_check: false
    image_block_response_delay: 250
    default_maximum_data_size: 50
    ota_base_url: http://localhost:8081/
    zigbee_ota_override_index_location: data/my_index.json
    zigbee_ota: true
    devices:
    '0xf4ce366c68e5776c':
    friendly_name: Nordic_Light_Bulb

     

  • You should add this code into the external converter

        ota: {
            ota: true,
            isUpdateAvailable: async (device, logger, data) => {
                return ota.isUpdateAvailable(device, logger, data, 'your_ota_index.json');
            },
            updateDevice: async (device, logger, data, onProgress) => {
                logger.info(`Starting FOTA update for ${device.ieeeAddr}...`);
                return ota.updateToLatest(device, logger, data, onProgress, 'your_ota_index.json');
            },
        },

Related