Changing brightness of one light group switches also every other light group on

Hey guys,

I have HA running in a container on my QNAP NAS. I have a Pi 3 which is running the deconz software using the ConBee stick. I have three different light groups:

  1. Living room - 6 Philips Hue lights
  2. Kitchen - 3 Philips Hue lights
  3. Dining - 1 Philps Hue light

I have input sliders for all three for changing the brightness and light colour. If I have only one group switched on and change the brightness of this group, all other groups are also switched on and the brightness is changed. What is wrong? Here is the code I am using:

configuration.yaml:

#Helligkeits Slider
input_number:
  esszimmer_bright:
    name: Helligkeit
    icon: mdi:brightness-6 
    initial: 75
    min: 1
    max: 254
    step: 10
  esszimmer_temp:
    name: Farbtemperatur
    icon: mdi:palette
    initial: 415
    min: 155
    max: 500
    step: 20
  kueche_bright:
    name: Helligkeit
    icon: mdi:brightness-6 
    initial: 75
    min: 1
    max: 254
    step: 10
  kueche_temp:
    name: Farbtemperatur
    icon: mdi:palette
    initial: 415 
    min: 155
    max: 500
    step: 20
  wozi_bright:
    name: Helligkeit
    icon: mdi:brightness-6
    initial: 75
    min: 1
    max: 254
    step: 10
  wozi_temp:
    name: Farbtemperatur
    icon: mdi:palette
    initial: 415
    min: 155
    max: 500
    step: 20

Automation.yaml:

- alias: Change Brightness
  trigger:
  - platform: state
    entity_id: input_number.esszimmer_bright
  - platform: state
    entity_id: input_number.esszimmer_temp
  - platform: state
    entity_id: input_number.kueche_bright
  - platform: state
    entity_id: input_number.kueche_temp
  - platform: state
    entity_id: input_number.wozi_bright
  - platform: state
    entity_id: input_number.wozi_temp
  action:
  - service: light.turn_on
    data_template:
      entity_id: light.esszimmertisch
      brightness: '{{ states.input_number.esszimmer_bright.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.esszimmertisch
      color_temp: '{{ states.input_number.esszimmer_temp.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.spot_kueche_1, light.spot_kueche_2, light.spot_kueche_3
      brightness: '{{ states.input_number.kueche_bright.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.spot_kueche_1, light.spot_kueche_2, light.spot_kueche_3
      color_temp: '{{ states.input_number.kueche_temp.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.spot_wozi_1, light.spot_wozi_2, light.spot_wozi_3, light.light_9, light.spot_wozi_5, light.spot_wozi_6
      brightness: '{{ states.input_number.wozi_bright.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.spot_wozi_1, light.spot_wozi_2, light.spot_wozi_3, light.light_9, light.spot_wozi_5, light.spot_wozi_6
      color_temp: '{{ states.input_number.wozi_temp.state | int }}'

Thank you in advance for your help! Please excuse the German words inside the code …

Really no one an idea?! :frowning:

Another German :wink: Welcome.

Well, it happens because thats what you told HA to do with your automation.
You say:

IF: any of my input numbers changes
THEN: Turn on all of the Lights.

If you want only the light to react that you actually trigger you need to rewrite your automation. Best start is to separate them.

Like this:

- alias: Change Brightness Esszimmer
  trigger:
  - platform: state
    entity_id: input_number.esszimmer_bright
  - platform: state
    entity_id: input_number.esszimmer_temp
  action:
  - service: light.turn_on
    data_template:
      entity_id: light.esszimmertisch
      brightness: '{{ states.input_number.esszimmer_bright.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.esszimmertisch
      color_temp: '{{ states.input_number.esszimmer_temp.state | int }}'

- alias: Change Brightness Kueche
  trigger:
  - platform: state
    entity_id: input_number.kueche_bright
  - platform: state
    entity_id: input_number.kueche_temp
  action:
  - service: light.turn_on
    data_template:
      entity_id: light.kueche
      brightness: '{{ states.input_number.kueche_bright.state | int }}'
  - service: light.turn_on
    data_template:
      entity_id: light.kueche
      color_temp: '{{ states.input_number.kueche_temp.state | int }}'

Ah ok, thank you @AlmostSerious! Thought that it must be a coding error. I thought that I could group all actions, etc. I am fairly new to HA and programming automations.

I don’t have any lights with changeable color, but I do have ones that dim, so I’m not sure about this, but can’t the light group be turned on with one service call that supplies both brightness and color_temp at the same time? Also, for state triggers you can list multiple entities. So:

- alias: Change Brightness Esszimmer
  trigger:
    platform: state
    entity_id: input_number.esszimmer_bright, input_number.esszimmer_temp
  action:
    service: light.turn_on
    data_template:
      entity_id: light.esszimmertisch
      brightness: '{{ states.input_number.esszimmer_bright.state | int }}'
      color_temp: '{{ states.input_number.esszimmer_temp.state | int }}'

- alias: Change Brightness Kueche
  trigger:
    platform: state
    entity_id: input_number.kueche_bright, input_number.kueche_temp
  action:
    service: light.turn_on
    data_template:
      entity_id: light.kueche
      brightness: '{{ states.input_number.kueche_bright.state | int }}'
      color_temp: '{{ states.input_number.kueche_temp.state | int }}'

I don’t know if this works, but I will try it. Everything which shortens the automation.yaml is welcome :wink: