Having issues setting temperature and brightness for multiple lights

I used to have a perfect working setup with my Hue bulbs connected with ZHA, where I would group them through ZHA and then I could simply create preconfigured values through the Lovelace dashboard that would apply to all lights in the group. This would work without fail, and all lights would always be synced with one press.

The Lovelace code would look something like this:


type: button
entity: light.common_room
tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    brightness: 108
    color_temp: 400
  target: {}

Then I went and introduced a led strip that is not from the Hue brand, and I noticed the scale of what color temperature the strip would be, was way off the other bulbs.

So to fix it, I need to provide different values. One set of values to the bulbs and another set to the strip. And as I can’t provide different values in the same button as above, I needed a different approach.

My first thought was to create a scene, where I targeted a group containing all other lights than the strip with X values, and then the strip with Y values, something akin to this:

- id: '1625858692608'
  name: Cozy
  entities:
    light.common_room_except_strip:
      brightness: 128
      color_temp: 440
      state: 'on'
    light.dining_room_strip:
      brightness: 51
      color_temp: 500
      state: 'on'
  icon: mdi:candle

And for Lovelace:

type: button
entity: light.common_room
tap_action:
  action: call-service
  service: scene.turn_on
  service_data:
    entity_id: scene.cozy
    transition: 2
name: Evening
icon: mdi:candle
state_color: false

Then I could call the scene through a Lovelace button, but the issue is that now, I get a lot of failures. Almost every time, one of the lights isn’t toggled, or it only changes brightness and not color temperature. If I hit the button a couple more times, it will eventually transition and mimic the others.

It appears to be random which lamp will act out, and I have a strong Zigbee mesh, which I suppose is evident, since the first method worked.

Does anyone know what the best method to change multiple lights, with different values, with one key press?

Try using a script instead of the scene.

1 Like

Thank you for the quick reply @Burningstone

Would you call the above scene through the script, or add the values within the script itself?

Call the script from your button and in the script execute the needed services to set temp and color.

1 Like

Hmm, I tried it and it still has a lot of flukes, where some lights don’t change, and I need to trigger it multiple times for it to set all lights.

I am really scratching my head here, as it works if I only call a single group, containing all lights. If I introduce a second target, it all goes to hell.

The script looks like this:

cozy_lights:
  alias: Set cozy lights
  mode: parallel
  sequence:
    - data:
        entity_id: light.common_room_except_strip
        brightness: 128
        color_temp: 440
      service: light.turn_on
    - data:
        entity_id: light.light.dining_room_strip
        brightness: 50
        color_temp: 500
      service: light.turn_on

Never mind, got it to work! :blush: