I while back I wrote a crude Python script to extract the final firmware to send as OTA from the Ikea download.
But I did not succeed, the devices did not want my extracted ‘blob’: Later I read there was some file corruption on Ikeas side.
Last week we had a lot of power outages. That made me do a lot of resetting and reregistration with those pesky Ikea devices.
So seeing this: RELEASE NOTES
Solves an issue where product become unreachable after a gateway restart.
I decided to give it a new round.
Posting my notes here for further comments and ideas
The Python script can be found here: GitHub - NilsOF/ikea-fw: Crude Zigbee Firmware extractor for IKEA
It is very simple:
- If it get a argument that contains “version_info.json” it just print out the json info in a bit more human readable way.
- if it get a argument that contains “.ota” it will look for a file and try to exctract the OTA bit.
when it finds a contained OTA, it extracts the OTA and just append “.ota” to the argument as a file name.
- Extraction is done this way: search for 0x0BEEF11E in the orginal Ikea binary download, This is the OTA header identificator and the start of the binary to be extracted.
The length of the OTA binary is then lifted out from the assumed to be valid OTA header.
Get a -json file to work on:
In openhab-console, find the device that you want to update and get the “Image Type ID”:
openhab> zigbee nodes Total known nodes in network: 2 Network Addr IEEE Address Logical Type State EP Profile Device Type Manufacturer Model 0 0000 000D6F000D3AF64C COORDINATOR ONLINE 25543 63C7 086BD7FFFE1AFDDC ROUTER ONLINE 1 ZIGBEE_HOME_AUTOMATION ON_OFF_PLUG_IN_UNIT IKEA of Sweden TRADFRI control outlet 242 ZIGBEE_GREEN_POWER 0061 openhab> zigbee read 25543/1 25 8 Reading endpoint 63C7/1, cluster client cluster Ota Upgrade (0019), attributes Image Type ID Response for cluster 0x0019 Attribute 8 Image Type ID UNSIGNED_16_BIT_INTEGER 4353 openhab>
run the python script with the .json file as argument:
Search the printout to find the ImageTypeID (in this case : 4353)
fw_binary_url : http://fw.ota.homesmart.ikea.net/global/GW1.0/01.17.019/bin/10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed fw_file_version_LSB : 38449 fw_file_version_MSB : 8968 fw_filesize : 209136 fw_image_type : 4353 fw_manufacturer_id : 4476 fw_type : 2
Download the binary and extract the OTA:
wget http://fw.ota.homesmart.ikea.net/global/GW1.0/01.17.019/bin/10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed ./ikeafw.py 10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed
the resulting file ( 10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed.ota ) can now be copyed to a place where openhab can read it. ( /var/lib/openhab )
in openhab-console see what the binding thinks about the file and start the OTA procedure.
openhab> zigbee otaupgrade file 10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed.ota OTA File: ZigBeeOtaFile [headerVersion=256, manufacturerCode=4476, imageType=1101, fileVersion=23089631, stackVersion=ZIGBEE_PRO, headerString=GBL GBL_tradfri_control_outlet, imageSize=209136] openhab> zigbee otaupgrade start 25543/1 10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed.ota OTA File "10005777-TRADFRI-control-outlet-2.3.089.ota.ota.signed.ota" set. openhab>
( imageType=1101 is hex for 4353 decimal )
I so far managed to upgrade the firmware on the control outlet in the notes above and 5 of my most anoying pesky bulbs.
What I notice is that “zigbee_datecode” seen in UI is not updated, but firmwareVersion is.
10 more pesky Ikea bulbs to go. It is tedious…
I really wish I could use the “Zigbee OTA Firmware Provider” described in ths thread: Zigbee OTA Firmware Provider
or mybe I can?
Extending my crude python to download, extract and pack up ready for the OTA firmware provider is something I can do, even with my limited programming skils.