dresden-elektronik / deconz-rest-plugin

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

Expose OTA file version for matchexpr #7642

Closed manup closed 7 months ago

manup commented 7 months ago

The PR introduces a new ResourceItem attr/otaversion which can be used to select DDFs. First example for it is the Ikea on/off switch which needs a DDF for newer and older firmware versions (will be added as separate PR).

How it works for Ikea on/off switch

DDF 1) The old firmware version DDF has following expression:

{
  "matchexpr": "var v = R.item('attr/otaversion').val; (v != 0 && v < 0x23079631);"
}

DDF 2) And the new one:

{
  "matchexpr": "var v = R.item('attr/otaversion').val; (v == 0 || v >= 0x23079631);"
}

Under the hood the PR does the following: