Koenkk / zigbee-OTA

A collection of Zigbee OTA files
410 stars 188 forks source link

Question: Why are the newest IKEA updates missing? #516

Closed konqi closed 2 months ago

konqi commented 2 months ago

During my research into why my TRADFRI open/close remote isn't working properly I saw that the ota version for many ikea devices in z2m is much older than the ones in the ikea release notes.

With a little research I found that the files are indexed and available for download via this version_info.json.

Now, I could simply add all those files and create a pull request (I even started to create a small script to do that). However this seems so easy that I started wondering why nobody else already did that.

Is there any reason those files are not added to the ota list (file-format? updates for ikea devices are handled entirely different? something else 🤷🏻)

Edit: Okay, I found out that this is actually handled by zigbee-herdsman-converters. Now I only need to figure out why the update isn't found 🕵🏻

Edit 2: Looks like fileVersion-wise my Open/Close button is up to date. Maybe I only see the wrong version number in the web-ui? 🕵🏻

[2024-06-26 11:00:14] debug:    zh:zstack:unpi:parser: <-- [254,34,68,129,0,0,25,0,203,5,1,13,0,98,0,10,49,222,0,0,14,1,80,1,1,124,17,197,17,6,0,4,36,1,0,51,158,28,203]
[2024-06-26 11:00:14] debug:    zh:zstack:unpi:parser: --- parseNext [254,34,68,129,0,0,25,0,203,5,1,13,0,98,0,10,49,222,0,0,14,1,80,1,1,124,17,197,17,6,0,4,36,1,0,51,158,28,203]
[2024-06-26 11:00:14] debug:    zh:zstack:unpi:parser: --> parsed 34 - 2 - 4 - 129 - [0,0,25,0,203,5,1,13,0,98,0,10,49,222,0,0,14,1,80,1,1,124,17,197,17,6,0,4,36,1,0,51,158,28] - 203
[2024-06-26 11:00:14] debug:    zh:zstack:znp: AREQ: <-- AF - incomingMsg - {"groupid":0,"clusterid":25,"srcaddr":1483,"srcendpoint":1,"dstendpoint":13,"wasbroadcast":0,"linkquality":98,"securityuse":0,"timestamp":14561546,"transseqnumber":0,"len":14,"data":{"type":"Buffer","data":[1,80,1,1,124,17,197,17,6,0,4,36,1,0]}}
[2024-06-26 11:00:14] debug:    zh:controller: Received payload: clusterID=25, address=1483, groupID=0, endpoint=1, destinationEndpoint=13, wasBroadcast=false, linkQuality=98, frame={"header":{"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":false,"reservedBits":0},"manufacturerCode":null,"transactionSequenceNumber":80,"commandIdentifier":1},"payload":{"fieldControl":1,"manufacturerCode":4476,"imageType":4549,"fileVersion":604241926},"command":{"ID":1,"response":2,"parameters":[{"name":"fieldControl","type":32},{"name":"manufacturerCode","type":33},{"name":"imageType","type":33},{"name":"fileVersion","type":35}],"name":"queryNextImageRequest"}}
[2024-06-26 11:00:14] debug:    zh:zstack:unpi:parser: --- parseNext []
[2024-06-26 11:00:14] debug:    z2m: Received Zigbee message from 'TradfriRemoteOpenClose2', type 'commandQueryNextImageRequest', cluster 'genOta', data '{"fieldControl":1,"fileVersion":604241926,"imageType":4549,"manufacturerCode":4476}' from endpoint 1 with groupID 0
[2024-06-26 11:00:14] debug:    zhc:ota:common: Got request '{"fieldControl":1,"manufacturerCode":4476,"imageType":4549,"fileVersion":604241926}'
[2024-06-26 11:00:14] debug:    zhc:ota:common: Is new image available for '0x842e14fffe783e62' (TRADFRI open/close remote), current '{"fieldControl":1,"manufacturerCode":4476,"imageType":4549,"fileVersion":604241926}'
[2024-06-26 11:00:14] debug:    zhc:ota:tradfri: Call getImageMeta for TRADFRI open/close remote
[2024-06-26 11:00:14] debug:    zhc:ota:common: Is new image available for '0x842e14fffe783e62' (TRADFRI open/close remote), latest meta '{"fileVersion":604241926,"url":"http://fw.ota.homesmart.ikea.net/global/GW1.0/01.21.031/bin/10005778-tradfri_onoff_controller-24.4.6-prod.ota.ota.signed"}'
[2024-06-26 11:00:14] debug:    zhc:ota:common: Update available for '0x842e14fffe783e62' (TRADFRI open/close remote): NO
[2024-06-26 11:00:14] info:     z2m: No update available for 'TradfriRemoteOpenClose2'
[2024-06-26 11:00:14] info:     z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/TradfriRemoteOpenClose2', payload '{"battery":200,"linkquality":98,"update":{"installed_version":604241926,"latest_version":604241926,"state":"idle"}}'
[2024-06-26 11:00:14] info:     z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/device/ota_update/check', payload '{"data":{"id":"TradfriRemoteOpenClose2","updateAvailable":false},"status":"ok","transaction":"6onb5-5"}'

Edit 3: Interesting 🤔 This is exactly the version I see in the ui. I should figure out where this is coming from 🕵🏻

Edit 4: Mh okay, so I finally understood that the fileVersion and the version in the filename are one and the same, since 604241926 = 0x0x24040006 = "24.4.6". Soooo, my device reports the latest firmware version. However the version number and fileVersion don't match up in z2m. I'm not sure how this can happen. The firmware itself appears to contain the correct version string at least in one place, however I could not find the 2.2.010 string in the binary. 🤔 So either the firmware sends mixed signals or something isn't interpreted correctly.

Edit 5: I can't figure out where softwareBuildID (or the firmwarea build date, which should be 20230308) is coming from or when and how it is set. I assume it's somewhere in the zigbee-herdsman-converters. I would assume this is set in the ikea.ts like in e.g. lumi.ts but it's not. 🤷🏻 I think this is as far as I can drill down into the issue on my own. But at least with this knowledge I might have to move the issue to a different repo 🤔

I believe this could be related to https://github.com/Koenkk/zigbee2mqtt/issues/9439 . I see two conditionals, A and B. Since z2m believes the device to be in firmware version 2.2.010 but in reality it is in 24.4.6 the exceptions are not applied. This also explains why the ui is telling me that the battery is at 200%.

konqi commented 2 months ago

I will move this issue to the zigbee-herdsman-converters repo, where I believe it should be 😉