What is the right and correct way to turn a light.group ON / OFF over a Automation?

Hello,

As the title says, I’ve been trying for 4 days to get my automation to turn on a light.group with a motion detector. the group consists of 5 identical bulbs

But either only one lamp goes on, or none at all, or none of the lamps go out

but if i switch the group manually using a switch, it works without a problem, i just switched the light on 20x and there wasn’t even a single problem.

I created the light group in deconz, previously I had this in HA but that didn’t work at all, and I was advised here in the forum to create the group in deconz because deconz has the status of the individual lamps.

my automation

alias: Gartenbeleuchtung - Bewegungsmelder
description: ''
trigger:
  - type: motion
    platform: device
    device_id: ea3fb3da59f4437dfd424a7b245c6291
    entity_id: binary_sensor.hue_bewegungsmelder_terrasse_motion
    domain: binary_sensor
condition:
  - condition: or
    conditions:
      - condition: sun
        after: sunset
      - condition: sun
        before: sunrise
action:
  - service: light.turn_on
    data:
      brightness_pct: 20
    target:
      entity_id: light.garten
  - wait_for_trigger:
      - type: no_motion
        platform: device
        device_id: ea3fb3da59f4437dfd424a7b245c6291
        entity_id: binary_sensor.hue_bewegungsmelder_terrasse_motion
        domain: binary_sensor
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.garten
mode: single

I really don’t know where the problem lies and why he doesn’t switch the light.group correctly.

okay i found this command

service: homeassistant.turn_off

or

service: homeassistant.turn_on

with this command it works right, but there its not possible to set a brightness or something else.

I suggest simplifying this and see if this works. Here is the “on” yaml. Just create another automation for off with the TO trigger as “off” and remove the condition, in the action change the service and delete the data line altogether

alias: Gartenbeleuchtung - Bewegungsmelder
trigger:
  - platform: state
    entity_id: binary_sensor.hue_bewegungsmelder_terrasse_motion
    to: “on”
condition:
  - condition: or
    conditions:
      - condition: sun
        after: sunset
      - condition: sun
        before: sunrise
action:
  - service: light.turn_on
    data:
      brightness_pct: 20
    entity_id: light.garten
mode: single

i tried it with light.on but this dont work right with the group and 5 lights.

i dont know why, but i then i had trouble.

If the group only has lights in it then it should work. However try homeassistant.turn_on

However if that is a problem with setting brightness then you might have to split your group and use two service calls in your action.