dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 502 forks source link

ResourceItems for device firmware #7961

Open ebaauw opened 3 weeks ago

ebaauw commented 3 weeks ago

To support automated checking if newer firmware is available for a device, the API needs to expose the firmware parameters, Manufacturer Code, Image Type, and File Version. This PR adds support for resource items cap/otau/manufacturer_code, cap/otau/image_type, and cap/otau/file_version, to be included in DDFs of devices that support OTA firmware upgrades. These items are exposed as a separate map under capabilities on lights and sensors resources:

  "capabilities": {
    "otau": {
      "file_version": 16786690,
      "image_type": 276,
      "manufacturer_code": 4107
    }
  }

They're also included as separate map in the capabilities websocket notifications.

Note that the items are populated from the Query Next Image Request, rather than from the optional (!) OTAU cluster attributes. cap/otau/manufacturer_code sends an Image Notify on read, triggering the Query Next Image Request, which also populates table in the OTA Update panel in the GUI.

This PR adds the new items to the DDFs for Hue devices and for some others that I had handy.

TODO:

TODO on the longer term:

ebaauw commented 3 weeks ago

Not sure why the validation checks fail. These changes pass ddf-tool validate locally:

$ ddf-tools validate -d devices
- Using validator version 2.31.1
✔ Found 662 files to validate
Skipping file devices/danalock/danalock_v3.json because it has the ddfvalidate option set to false
Skipping file devices/legrand/cable_outlet.json because it has the ddfvalidate option set to false
✔ Loaded 270 generic files and 390 DDF files from disk
✔ No errors found in 270 generic files
✔ No errors found in 390 ddf files

For posterity: that was caused by an item JSON filename not ending in ..._item.json.

github-actions[bot] commented 2 weeks ago

Hey @ebaauw, thanks for your pull request!

[!TIP] Modified bundles can be downloaded here. Relative expire date

DDB changes

Modified

Validation

[!TIP] Everything is fine !

:clock2: Updated for commit 065f6b9bc079055f5db2099c24799899883bc6f0

Zehir commented 2 weeks ago

Not sure why the validation checks fail. These changes pass ddf-tool validate locally:

$ ddf-tools validate -d devices
- Using validator version 2.31.1
✔ Found 662 files to validate
Skipping file devices/danalock/danalock_v3.json because it has the ddfvalidate option set to false
Skipping file devices/legrand/cable_outlet.json because it has the ddfvalidate option set to false
✔ Loaded 270 generic files and 390 DDF files from disk
✔ No errors found in 270 generic files
✔ No errors found in 390 ddf files

The issue was because the bundler was not able to find the generic file for attr/otau/imagetype he was expecting the location generic/items/attr_otau_imagetype_item.json Updated in https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7961/commits/c672d71219d1d09cccdb9d3b4aec5c69800d3161