doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 15 forks source link

Can't run OTA updates for TRADFRI devices #53

Closed benjR closed 4 years ago

benjR commented 5 years ago

Hi, I have been trying to update my TRADFRI devices with latest firmwares that can be found here: https://fw.ota.homesmart.ikea.net/feed/version_info.json but whenever I try to load a firmware I have a warning like so:

Header size(3684586090) and file size(174150) does not match
00:37 custom_components/zigate/__init__.py (ERROR)
Header size(1177025433) and file size(205190) does not match
00:31 custom_components/zigate/__init__.py (ERROR)

Am I the only one? Is there something I am missing ? Thanks :)

Xavier-M commented 5 years ago

I just tried with the Ikea Outlet with the firmware download from your file and I have the same error.

doudz commented 5 years ago

According to this https://github.com/fairecasoimeme/ZiGate/issues/86#issuecomment-447884154 the files need to be converted before, because Ikea doesn't use standard OTA file format

Currently I don't know how the conversion works, so you need deconz to do the job

doudz commented 5 years ago

So conversion looks easy, if I'm right we just have to remove a digital signature, so just the begining and the ending of the file

doudz commented 5 years ago

I just add a small converter, if you want to try it https://github.com/doudz/zigate/blob/dev/ikea_ota_converter.py

Usage : python3 ikea_ota_converter.py /home/doudz/otau/ikea_firmware.ota.signed

The file will be converted and save with the same file name

Xavier-M commented 5 years ago

With a quick test I still have the error with the file 10005777-4.1-TRADFRI-control-outlet-2.0.022.ota.ota.signed

Before it was: Header size(1177025433) and file size(205190) does not match

Now it is: Header size(797) and file size(204221) does not match

doudz commented 5 years ago

oups, should be ok now

nerdosity commented 5 years ago

How is the syntax to load a new firmware on a device? Is this integrated in home assistant or command line only?

doudz commented 5 years ago

The small converter created is just a test file, if it's working good, the code will be included in the zigate lib so it will be transparent for user For now you have to use command line to convert the file first to make it compatible

Xavier-M commented 5 years ago

The converter is OK now :) I updated one Outlet successfully.

benjR commented 5 years ago

Nice! Thanks a lot @doudz Will test this as well, is there any output in the logs to check if version was really updated?

doudz commented 5 years ago

The converter is OK now :) I updated one Outlet successfully.

Nice, I have included the converter in the next zigate release

doudz commented 5 years ago

@benjR looking in the zigate.json, you should see different application version or datecode for the cluster 0 of the device you may have to read the attribute manually by calling read_attribute on cluster 0 and attribute 1 or attribute 6

nerdosity commented 5 years ago

Does IKEA release a changelog of their bulbs? 😆

benjR commented 5 years ago

@nerdosity It's in the json file in my first comment: https://ww8.ikea.com/ikeahomesmart/releasenotes/releasenotesltd.html

benjR commented 5 years ago

From my readings in the logs, the update has been successfull for my outlet. However can't see any difference while comparing the zigate.json before/after.
Will try on another device.

doudz commented 4 years ago

You should try to call the service zigate.read_attribute on attribute 0x0006 of cluster 0x0000 example :

{
  "entity_id": "zigate.000b57fffe2ae07d",
  "endpoint": 1,
  "cluster": 0,
  "attribute_id": "0x0006"
}

The value is visible on the zigate device entity image