Deconz-out with transition time

I am trying to get the colour effects output of the Hue Magic node (node-red-contrib-huemagic) to my Zigbee lights via the deconz-out node (node-red-contrib-deconz). Basicall Hue Magic outputs a colour hex-code and a transition time, of which I convert the hex to HSV values and adjust those in range.

As I need to feed two parameters (e.g. Hue and Transition Time) into each deconz-out node I wanted e.g. the Hue value be read from msg.payload.hsv.hue and the Transition Time from msg.payload.transitionTime. However, this does not work. I always get an "invalid value for parameter" error.

Setting a fixed transition time and msg.payload as payload in deconz-out, plus adding a change node to move msg.payload.hsv.hue to msg.payload in the upstream would make everything work, albeit ignoring the transition time.


deconz-out settings:

What am I doing wrong?
I hope this is not too much of a noob question... :slight_smile:

Is msg.payload.transitionTime still present after the Color Converter Node? I would not be surprised if msg.payload is completely overwritten with the HSV values. If this is the case, I would copy the variable to another place before, e.g. msg.transistiontime or as flow variable.
You could also pack everything into a json object for the deconz out node and select "object json" as option command. Then you would only need to use one deconz out node.

1 Like

...thanks steff, I got this up and running by packing the required data into a JSON object as you suggested, following the deconz API documentation. :partying_face:

This is the flow:

[{"id":"a2d6592.5f6dfa8","type":"hue-magic","z":"a26c11c5.cbe52","name":"Night Sky","endless":true,"restore":false,"preset":"003-nightsky","steps":"[{\"delay\":0,\"animation\":{\"hex\":\"#0029ff\",\"transitionTime\":15}},{\"delay\":0,\"animation\":{\"hex\":\"#6ca9ff\",\"transitionTime\":15}}]","x":520,"y":780,"wires":[["e13ac6cb.6b0e78"]]},{"id":"e13ac6cb.6b0e78","type":"node-red-contrib-colorspace","z":"a26c11c5.cbe52","name":"","target":"payload","x":680,"y":780,"wires":[["489e9ae.4565864"]]},{"id":"4bcb9d42.6ccbb4","type":"rbe","z":"a26c11c5.cbe52","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":370,"y":780,"wires":[["a2d6592.5f6dfa8"]]},{"id":"99e6ea66.95e218","type":"deconz-output","z":"a26c11c5.cbe52","name":"","server":"a2a0bebe.0f766","device":"group_29","device_name":"â—‹ RGB Wohnzimmer","command":"json","commandType":"object","payload":"payload","payloadType":"msg","transitionTime":"","transitionTimeType":"num","x":1120,"y":780,"wires":[]},{"id":"489e9ae.4565864","type":"function","z":"a26c11c5.cbe52","name":"deconz JSON","func":"if (typeof msg.payload.on !== 'undefined') {\n    \n    var on = msg.payload.on;\n    var hue = msg.payload.hsv.hue;\n    var sat = msg.payload.hsv.saturation;\n    var bri = msg.payload.brightness;\n    var transitiontime = msg.payload.transitionTime;\n    \n    delete msg.animation;\n    msg.payload = {};\n    msg.payload.on = on;\n    msg.payload.transitiontime = transitiontime;\n    msg.payload.hue = Math.round(hue / 360 * 65535);\n    msg.payload.sat = Math.round(sat / 100 * 255);\n    if (typeof bri !== 'undefined') {\n        msg.payload.bri = Math.round(bri / 100 * 255);\n    }\n    \n    return msg;\n\n} else {\n    return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":880,"y":780,"wires":[["99e6ea66.95e218"]]},{"id":"a2a0bebe.0f766","type":"deconz-server","name":"","ip":"","port":"80","ws_port":"443","secure":false,"polling":"15"}]

I'll have to add a routine for randomizing colours in the deconz JSON node, but everything else looks good so far.

Thanks again! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.