dotsam / homebridge-milight

MiLight/LimitlessLED/Easybulb Plugin for Homebridge
MIT License
63 stars 12 forks source link

Color toggling issue #27

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi, I have 1 RGBW bulb connected to a V6 bridge. I have set two scenes in Homekit (Bedroom Lights , Night Lights) Bedroom Light --> Color White , Brightness 100% Night Light --> Color Blue , Brightness 6%

When i select the Bedroom Light the bulb turn white 100%, when I click on the Night Light bulb becomes Blue 6%, But when I click back on Bedroom the bulb switch to white 6% not 100%. To make the brightness 100% have to toggle on/off the Bedroom light.

Do you have any advice to solve the issue please?

dotsam commented 7 years ago

Can you provide some Homebridge logs for when this happens? RGBW bulbs track brightness for white mode and colour mode independently, and depending on the order in which HomeKit sends the colour/brightness commands, this could be a problem.

ghost commented 7 years ago

the logs attached have just been generated showing what happen when i click on the Night Light scene --> Bedroom Light (which turn up to 6%) -->Bedroom Light (which switch if the lamps) --> Bedroom Lights (which switch the bulb back to 100%)

HomebridgeLog.zip

dotsam commented 7 years ago

Sorry about the late response here. This issue appears to be related to both the order in which HomeKit sends commands, and how to bulbs keep track of brightness level.

In the logs you attached, you'll notice that the brightness is being sent before the hue/saturation commands. So the bulb is still in colour mode when it receives the 100% brightness command, but then when it switches back to white mode, it's at 6%, as this is the last brightness level that was set in white mode. The bulbs track the brightness level separately for colour and white modes.

The fix for this is for the plugin to keep track of the state of the bulb (white or colour) and ensure that brightness is set again when changing modes. I'm internally tracking a number of different properties for the bulbs, so if I'm going to add this, I might want to re-think how I'm doing some things.

ghost commented 7 years ago

Hi, thank you for the update. i will be waiting impatiently for the plugin update. Good Luck with the plugins and Thanks.