LED Calculator for LZW31-SN dimmers

Hi all,

Just a quick question. Do the dimmers use the same LED notification calculator as the on/off switches?


@silencery - I believe so…I thought the LED notifications were based on RGB codes, so it should be the same; however, maybe @EricM_Inovelli did some wizardry magic…

1 Like

It’s more than just “RGB codes”–the LED notification parameter crams four things into one parameter: color, level, duration, and effect. The parameter is 4 bytes wide and each of these aspects occupies one of the bytes. Since that doesn’t line up nicely with human-friendly base-10 numbers most English speakers (and most of the world) are used to using, the calculator is the easiest way to convert your desired settings into this friendly form.

That being said, this conversion is the same for both the switch and dimmer according to their ST and Hubitat DTH/driver code. The only difference is that it’s set on parameter 8 for the switches or 16 for the dimmers. In either case, the calculation in decimal form is this:

color*1 + level*256 + duration*65536 + effect*16777216

Here, color is 0-255 (scaled from the conventional 0-360 hue values where both extremes are red), level is 1-10 (LED brightness), duration is 1-255 (desired duration in number of seconds 1-254 or 255 for indefinite), and effect is 0-5 (for off, solid, chase, fast blink, slow blink, and pulse, respectively; chase is not available on the switches).


^ Is not a programmer nor does he code; all greek to me. @BertABCD1234 - In for the win.

In the end, RGB codes is simpler to refer :stuck_out_tongue:

Am I doing something wrong then?

I’m using code 83823231 (color: Cyan, effect: pulse, time: indefinite, brightness: max) and this works perfectly on the LZW30-SN switch. However, when I use the same code on the dimmers, the effect is more like a slow blink rather than pulsing.

Any advice appreciated.


(tagging @Eric_Inovelli)

I thought there are 5 effect codes for the dimmers and 4 for the switches.

There is a slight difference in the effect types on the dimmer vs the switch. A community member is creating a interactive calculation tool, but you can try this one in the meantime:

1 Like

Awesome, i’ll give it a shot, thanks!

Just wanted to report back that it worked perfectly. LED effects working great. Thanks!

Good explanation by BertABCD1234 but I am somewhat confused by this thread Reading the documentation that came with my dimmer it says choose
byte 1 - color
byte 2 - brightness level
byte 3 - effect
byte 4 - duration
The formula from BertABCD1234 and in EricMs Spreadsheet is for
byte 1 - color
byte 2 - level
byte 3 -duration
byte 4 - effect
duration and effect are different from the documentation, Which is correct
Also Berts wording implies implies for effect
off- 0
solid - 1
Fast Blink -2
Slow Blink - 3
Chase -4
Pulse -5
But the ericM’s spread sheet below has
off -0
solid -1
Fast Blink -3
Slow Blink -4
Pulse - 5

Is there a place this is spelled out specifically?

Thanks for for your help

I must have mis-typed. Here is the correct mapping for the LZW31-SN (the LZW30-SN is similar except the LED is too small to support the “chase” effect, which is compensated for by everything above it going down by one number):

["off": 0, "solid": 1, "chase": 2, "fast-blink": 3, "slow-blink": 4, "pulse": 5]

I’m not aware of anywhere where this is spelled out specifically. The best place to look would probably be the driver/handler for your favorite platform (e.g., here is theirs for Hubitat) and work backwards where necessary with whatever algebra you may need to figure out how to calculate the final result from what initial values. :slight_smile: (That’s how I did the above with my custom driver.)

That being said, I’ve edited my post and think the calculation I’ve listed there is correct now.