deconz-community / node-red-contrib-deconz

Node-Red Nodes for deCONZ connectivity.
GNU General Public License v3.0
81 stars 16 forks source link

Turn on/off with brightness values does not work in 2.x #160

Closed raddi closed 2 years ago

raddi commented 2 years ago

So with the new 2.x version, i can't get my dimmable lights to turn on or off with just the brightness values. All of my node-red flows are useless and i cannot figure out how to repair them. In Version 1.x i could simply set the lights to "brightness" and send values between 0 and 255 to change the brightness, when sending 0, turning the lights off and all values greater 0 would turn the lights on. How do i implement this feature in version 2.x?

Thanks in advance.

raddi commented 2 years ago

Okay so i "fixed" this by adding 2 instances of the same dimmable light and a switch node to separate 0 from >0 values and then set one instance to "off" and listen to brightness and one to "on" and listen to brightness. Next thing is, i can't control my window cover anymore, i will open another bug report.

Zehir commented 2 years ago

Yes brightness 0 is not always an off value, sometime it's off, sometime it's minimal brightness. If you wan't to turn of a light you need tu set the value On to false.

raddi commented 2 years ago

I just have to get used to the new way of configuring the nodes.

schweighart commented 2 years ago

There is a better way than adding two instances of the same light. I configured my lights this way: light And added a function node upfront with the following code:

if (msg.payload>0) {
    return { onoff:true, payload:msg.payload };
} else {
    return { onoff:false };
}
Zehir commented 2 years ago

There is a better way than adding two instances of the same light. I configured my lights this way: light And added a function node upfront with the following code:

if (msg.payload>0) {
    return { onoff:true, payload:msg.payload };
} else {
    return { onoff:false };
}

Yes for some device the brightness 0 is not always off, sometime it's minimum brightness.

But you can do something like this : image

schweighart commented 2 years ago

Thanks. Your solution is awesome. I didn't know that I can use operators in this field.