Skip to content

Using device specific configurations

asgothian edited this page Jan 11, 2022 · 1 revision

Device specific configurations

Some Zigbee devices allow for parameters to be configured without having those parameters exposed as states in ioBroker. Most of these (but not yet all) can be configured using Javascript, Blockly or NodeJS.

In order to use this function, the payload needs to be identified. It is specified in the device description on zigbee2mqtt.io. As an example, the lightbulb Philips 9290024689 offers an option to configure the power on behavior through the payload

{
    "hue_power_on_behavior": "on",          // default, on, off, recover
    "hue_power_on_brightness": 125,         // same values as brightness
    "hue_power_on_color_temperature": 280,  // same values as color_temp
    "hue_power_on_color": "#0000FF"         // color in hex notation, e.g. #0000FF = blue
}

Additionally, the function can also be used to directly set a value to any exposed state by sending the described payload via the sendToDevice function. Even combined messages should be possible similar to the Hue Adapters command state. A payload of

{ 
   "state": "ON",
   "color":{"h":360,"s":100,"b":100},
   "transition":10
}

should turn the bulb on in bright red with a 10 second transition time.

Note that while this is possible, not all devices may accept combinations of all options. Some options will require multiple calls.

Use of this functionality is simple:

Javascript

sendTo('zigbee.0', 'SendToDevice', {'device':'00abcd00ffeebeef', 'payload':{ <YourPayloadHere> }
    }, function(res) {
    if (res.success)
      console.log("success")
    else
      console.log(res.error);
    });

Blockly

Blockly has its own sendTo Block which needs to be extended to include 2 parameters. Those parameters must be named device and payload for the function to work as intended. The Parameters sendTo and command need to be filled with the zigbee instance (zigbee.0) and the function name (SendToDevice). The additional parameters contain the ieee of the device (00abcd00ffeebeef) and the payload taken from the zigbee2mqtt.io page.

Node Red

-- upcoming --