Possible milight bug

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:

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

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

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

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.