# Possible milight bug

**URL:** <https://community.openhab.org/t/possible-milight-bug/13093>\
**Category:** Bindings\
**Tags:** milight\
**Created:** [August 8, 2016, 10:47pm UTC](https://community.openhab.org/t/possible-milight-bug/13093 "2016-08-08T22:47:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rich0](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@rich0](https://community.openhab.org/u/rich0)\
**Post date:** [August 8, 2016, 10:47pm UTC](https://community.openhab.org/t/possible-milight-bug/13093/1 "2016-08-08T22:47:36Z")

</div>

I’m having issue with milight. When I am running rules in one room, I’m getting lights turning off in other rooms.

I noticed that the light that turns off was the last one touched in the other room.

Looking at the milight API it looks like you have to send the group on command to the light BEFORE any brightness commands to select the bulb. The actual brightness commands don’t contain any addressing.

I’m looking at the source and see a potential issue. Looking at:

> <https://github.com/openhab/openhab1-addons/blob/1.8/bundles/binding/org.openhab.binding.milight/src/main/java/org/openhab/binding/milight/internal/MilightBinding.java>

From Line 102:  
if (IncreaseDecreaseType.INCREASE.equals(command)) {  
sendOn(bulb, bridgeId);  
Thread.sleep(100);  
PercentType newValue = sendIncrease(bulb, rgbwSteps, bridgeId);  
eventPublisher.postUpdate(itemName, newValue);  
} else if (IncreaseDecreaseType.DECREASE.equals(command)) {  
PercentType newValue = sendDecrease(bulb, rgbwSteps, bridgeId);  
eventPublisher.postUpdate(itemName, newValue);  
} else if (command instanceof PercentType) {  
logger.debug(“milight: command is of type PercentType”);  
sendPercent(bulb, rgbwSteps, bridgeId, (PercentType) command, BindingType.brightness);  
}

If the command is an INCREASE command it looks like it is sending the ON command to the bulb which addresses it. However, for the other two changes the bulb is never addressed, which means the bulb that was last addressed will end up receiving the command.

I suspect that you’re going to want to add a LOT more sendOn(bulb, bridgeId); commands to that file, or you’re going to want to check your conditions and move that outside of the if blocks. I suspect it would be appropriate to send that first for anything other than the command to turn the bulb off.

As a workaround, I’ve confirmed that sending the INCREASE command to a bulb before sending it a dimmer command makes the random light issues go away.  
Example workaround here:  
[https://github.com/rich0/home-openhab-config/commit/0740f6e3ffde9ee6d95b468465af38e241bca112](https://github.com/rich0/home-openhab-config/commit/0740f6e3ffde9ee6d95b468465af38e241bca112)

Hopefully this gets noticed by the right people. If there is some kind of bug reporting tool for the project please let me know.

---

<div class="post-metadata">

**Author:** ![notanatheist](https://community.openhab.org/user_avatar/community.openhab.org/notanatheist/32/37734_2.png) [@notanatheist](https://community.openhab.org/u/notanatheist)\
**Post date:** [August 8, 2016, 11:04pm UTC](https://community.openhab.org/t/possible-milight-bug/13093/2 "2016-08-08T23:04:02Z")

</div>

> <https://github.com/openhab/openhab1-addons/pull/2571>
>
> Extended night mode support to the newer RGBW bulbs.
> 
> The white Milight bulbs ha…ve 10 levels of brightness + Off so there are 11 possible settings between 0 and 100%. It was at 10 settings and so a disparity between desired brightness setting vs. actual brightness would accrue during use. Also, to engage the desired bulb, an on signal needed to be sent before the brightness setting. Lastly, white bulbs are powered to lowest setting before off, and when powering on this is taken into account. All these fixes combined finally allows the brightness to be very accurate and reliable for the white bulbs.

This guy looks like the maintainer of the binding. Perhaps submit your fixes there?

---

<div class="post-metadata">

**Author:** ![rich0](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@rich0](https://community.openhab.org/u/rich0)\
**Post date:** [August 9, 2016, 12:13am UTC](https://community.openhab.org/t/possible-milight-bug/13093/3 "2016-08-09T00:13:29Z")

</div>

I’ll confess that I’ve barely dabbled in Github pull requests/etc. Is there some way to submit an issue without an actual patch?

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [October 12, 2016, 6:25am UTC](https://community.openhab.org/t/possible-milight-bug/13093/4 "2016-10-12T06:25:04Z")

</div>

> [@rich0](#):
>
> I’ll confess that I’ve barely dabbled in Github pull requests/etc. Is there some way to submit an issue without an actual patch?

This has been fixed and a PR is waiting to be merged.
