Setting LIFX bulb colour - inconsistent colours using service vs entities card

I recently set up an automation to turn on two LIFX rgb wifi bulbs to a specified colour. I.e. like this:

...
action:
  - service: light.turn_on
    data:
      transition: 2
      rgb_color: [255, 208, 171]
      brightness_pct: 50
    target:
      entity_id: light.tv_lamps
...

The automation works as designed - except that the colour is significantly different to that when setting the same rgb values with the standard light pop-up (sorry - I don’t know what this is called) that displays when clicking on same light helper in the Entities Card. BTW this light helper is set to a group of 2 bulbs (tv_lamps).

The automation above sets the bulbs to a very warm / almost orange colour. The light pop-up, when clicking on a preset colour with the same rgb values, sets the bulbs to an off-white colour.

Does anyone have an idea why the same rgb values give different colours?

Thanks,
Justin.

Might be related:

Not sure if they actually opened an issue or not.

are you using the LIFX driver for the bulbs or the HomeKit driver? This is a similar issue that I have that I have submitted LIFX Native Driver vs HomeKit for LIFX Driver Functionality · Issue #98634 · home-assistant/core · GitHub to address.

Thanks @tom_I and @marshall.tech.

That reported issue does sound related to mine. However I don’t have the HomeKit integration installed (it’s looks interesting though).

I switched on debugging for the LIFX integration but when setting a bulb colour, the debug log entry only states "Manually updated ". I.e. I can’t confirm that the correct colour is being set.

However, when downloading a bulb entity diagnostic after (1) setting the colour via calling the light.turn_on service, and (2) setting the colour via the standard entities card light pop-up, I can see that HA has set different colours, e.g.

Setting RGB = [255, 208, 171] via light.turn_on service, the diagnostic reports:

      "hue": 4811,
      "saturation": 21587,
      "brightness": 32896,
      "kelvin": 3500,
      "power": 65535

Setting RGB = [255, 208, 171] via the entities card light pop-up, the diagnostic reports:

      "hue": 4811,
      "saturation": 0,
      "brightness": 32896,
      "kelvin": 4114,
      "power": 65535

Which one is correct? (I don’t know how to map RGB to Hue, Sat., Brightness, Kelvin).

Environment:

  • Home Assistant OS 10.4
  • Version: 2023.8.3

Cheers,
Justin,

Yikes. Neither of them are correct. Hue should be a number between 0 and 360, saturation should be a number between 0 and 100. And brightness should be a value between 0 and 255.

Something very wrong there.

No, there isn’t. It’s just confusing. The underlying aiolifx library uses values between 0-65535 for each of HSB with only Kelvin being the actual value. HSB is converted into the actual values when the packet is generated for the LIFX LAN protocol.

Also, I answered the related GitHub issue, but the TL;DR is that LIFX color bulbs do not expose their color termp LEDs to HomeKit. If you want actual control of that, you need to use the LIFX integration.

1 Like

Ok, but why are the same RGB numbers mapping to different HSB/Kelvin numbers for the two methods of setting bulb colour described above?

The luight.turn_on call is actually setting RGB as saturation is not 0. If the saturation value is 0, the LIFX bulb is in color temp/kelvin mode. So in the second one, it’s at 4114 kelvin and is not in RGB mode.

After mucking around with this a bit, it seems to me that there is something buggy with the standard entities card light pop-up colour selector with LIFX bulbs (using the LIFX integration).

I’ve repeated the following with a LIFX bulb:

  1. Call light.turn_on with random RGB values.
  2. Click on an entities card with this light and open the pop-up light control / colour selector.
  3. Click on the colour wheel and click on the eye dropper. The eye dropper shows different RGB values.

If I then click on the colour shown by the eye dropper (i.e. with the “different” RGB values) the bulb stays the same colour. Bizarre.

If I type in the RGB values from Step 1 into the eye dropper, the colour changes!

Sometimes however, the eye dropper in Step 3 returns the same RGB values as set in Step 1. But the behaviour is repeatable for a given colour.

So I think the logic for reading a LIFX colour and converting it to RGB is buggy.

Cheers,
Justin.

LIFX bulbs don’t have RGB values, so this is not surprising. Something has to convert from RGB to HSBK. Can you provide some example RGB values that when entered via the entities card results in this difference? I can then try and work out where the problem is.

Hi @Djelibeybi ,

The following RGB examples show different colours when set vy light.turn_on service vs the entities card (all have brightness set at 50%):

  1. 255 259 70
  2. 255 208 171

But the entities card colour wheel seems to be buggy. If I set a colour via the eye dropper to 123 45 67, then close the eye dropper, then open it again, is shows the RGB as 255 93 138. But the bulb doesn’t appear to change colour.

Cheers,
Justin.

1 Like