Milight brightness

As said in other discussions, I will have a look at the brightness jssue.
But always keep in mind, that there is no possibility to sync the state if you use the remote, the phone app or openHAB. Milight is a one way communication.


Thanks Hans-Jörg

It’s for this very sync reason that I will refer openhab to do all interactions with the bulbs.

Much appreciated.



According to the LimitlessLED dev wiki the following commands are used to change brightness.

45 00 55 wait 100ms then send 4E XX 55 - Set Zone 1 to Brightness XX (XX range is 0x02 to 0x1B) 47 00 55 wait 100ms then send 4E XX 55 - Set Zone 2 to Brightness XX (XX range is 0x02 to 0x1B) 49 00 55 wait 100ms then send 4E XX 55 - Set Zone 3 to Brightness XX (XX range is 0x02 to 0x1B) 4B 00 55 wait 100ms then send 4E XX 55 - Set Zone 4 to Brightness XX (XX range is 0x02 to 0x1B)

From my debug windows’s output on the first post (zone 2 being sent) you can see the 47 00 55 sent first followed by 4E 11 55. The latter sets the brightness which in openhab was at 90%. However as the value sent to the bridge is 11 (middle value), in relation to a maximum of 1B, it equates to about 68% brightness.

This is inline with what I am seeing. If I’m right then the scaling in the binding should be changed…?

Thanks for doing some more debugging.
I will have a closer lok at it. Just did a quick review of the code but did not see any wrong scaling at first sight.
The code should transform 90% to a message byte of 18, not 11 like in your logs.



So I eventually figured it out! Really my own stupidity at play here, but I did find a small bug… So it seems that my bulbs have 27 steps as per two posts ago. By me overriding the steps to 10 in my items file I caused 10 to be my maximum. When I changed this to 27 and send a 100 brightness command; now the light goes on full and I can see the correct message sent to the bridge. :yum:

The thing is that when I dimm the lights to 1 then nothing happens. This is as a result of the steps (as per API) being defined for the range 0x02 to 0x1B. So when I send a 1 it equates to 1 * 27 / 100 = 0 (int). The lowest value that can currently be sent for a dimm is actually 8, i.e. 8 * 27 / 100 = 2.16 (=2 = 0x02).

So I believe line 271 (and corresponding ones) should change from:

int newCommand = (command.intValue() * rgbwSteps / 100);


int newCommand = (command.intValue() * (rgbwSteps - 2) / 100 + 2);

In doing so the following will happen:

Send value of 1:    newCommand = 1 * (27 - 2) / 100 + 2 = 2.25
Send value of 50:   newCommand = 50 * (27 - 2) / 100 + 2 = 14.5 (full range 25, so 2+25/2 = 14.5, exactly halfway)
Send value of 100:  newCommand = 27

This works for any step value. It will start at 2 and step to the defined max steps at 100 brightness.


1 Like

Thanks for digging into it and finding the issue.
I will try to implement this fix over the weekend an create a PR, so it could be used very soon.


1 Like

Hi Hans-Jörg,
I am also affected by this error.
When can you fix it?

Many thanks!

just created PR 3252 to implement this fix.


PR is merged, so the bugfix should be available with next snapshot build.


Thanks! Sounds good!

Can you give me the org.openhab.binding.milight-x.x.x.jar file earlier?
Have no idea of java compiling and my pregnant wife stumbles without light through the apartment.

many thanks

Hi, it’s been a while since I’ve looked into this issue again but after installing OpenHAB on a new server today I realise the milight binding is still having the same issue. When I switch off a light it looks like it dims it first and then off. And then when I switch it back on it’s at the very lowest brightness setting.

Did you ever confirm that you resolved this issue?

This is the content of the OpenHAB log file with debug logging turned on. All I did was switch the light bulb off… I’m not using a dimer…

01:13:49.003 [DEBUG] [.o.b.m.internal.MilightBinding:664 ] - milight: sendOff
01:13:49.004 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.005 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '91’
01:13:49.007 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.009 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.111 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.112 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '82’
01:13:49.114 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.117 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.219 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.220 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '73’
01:13:49.222 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.225 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.327 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.328 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '64’
01:13:49.330 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.332 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.434 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.435 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '55’
01:13:49.437 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.440 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.542 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.543 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '45’
01:13:49.545 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.547 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.649 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.650 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '36’
01:13:49.652 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.655 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.757 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.758 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '27’
01:13:49.760 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.763 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.865 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.866 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '18’
01:13:49.868 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.870 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:49.972 [DEBUG] [.o.b.m.internal.MilightBinding:350 ] - milight: sendDecrease
01:13:49.973 [DEBUG] [.o.b.m.internal.MilightBinding:383 ] - milight: Bulb ‘1’ getting decreased to '9’
01:13:49.975 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '34:00:55’
01:13:49.977 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘34:00:55’ to bridge ‘bridge1’ (
01:13:50.079 [DEBUG] [.o.b.m.internal.MilightBinding:786 ] - milight: messageBytes to transform: '3B:00:55’
01:13:50.081 [DEBUG] [.o.b.m.internal.MilightBinding:778 ] - Sent packet ‘3B:00:55’ to bridge ‘bridge1’ (

I will try to find the time to look into this.
BTW, we now have a native openHAB2 binding for the MiLight bulbs …

I’m also getting this kind of flaky behavior on my milight white bulbs. Some don’t come on to 100%, even though I’m sending the ON command to the brightness value. I’m seeing this when I send the ON to a group:switch the bulbs are assigned to.

If I jiggle the slider in Android I can get it back to 100%.

Not sure if there is anything I can do to help troubleshoot. This is on 1.8.3.

I’m also having the same problem. I tried implementing the virtual switch that was suggested in another post, but I’m getting an error

Cannot determine item type of 'officeVirtualLightON’
org.openhab.core.items.ItemNotFoundException: Item ‘officeVirtualLightON’ could not be found in the item registry

So I must not have that set up correctly, although I cannot spot the error.

Please post your item config and the rule you are using.

BTW, a PR is waiting to be merged to solve a dimming issue.
It can be found here for testing.

I have posted my files after a similar closed topic, since I tried that solution

I’ve tried to implement this as well, but I’m getting an error -

Cannot determine item type of ‘officeVirtualLightON’ org.openhab.core.items.ItemNotFoundException: Item ‘officeVirtualLightON’ could not be found in the item registry7

Items (I’m not sure what is the function of the first labels in the definitions “Brightness” etc, I have tried with and without these) -

Switch officeMilight {milight=“mlbLounge;1”}
Switch officeMilightNight {milight=“mlbLounge;1;nightMode”}
Dimmer officeMilightBright “Brightness” {milight="mlbLounge;1;brightness}
Switch officeVirtualLightON “On/Off” {milight=“mlbLounge;1”}

sitemap -

Frame {
    Text label="Lights" icon="bulb" {
        Text label="Office" icon="bulb" {
            Switch item=officeMilight label="On/Off"
            Switch item=officeMilightNight label="Night Light"
            Switch item=officeVirtualLightON label="Brightness"

rules -

rule "Office Light On"
item officeVirtualLightON received command ON

I’ve tried several variations of this configuration, the error persists.

Yes, saw your double plost, please avoid to do so.
I commented in your other post.

Apologies, I will continue on the other post