Zigbee2mqtt simultaneous processing of commands

Hello everyone,

I have a problem with my HomeAssistant automation where I want to turn several sockets on or off via switch.turn_on, but only individual devices are activated.

I’m wondering if others are experiencing this issue and why Zigbee2mqtt is not buffering this and running so poorly.

One possible solution is to define the relevant sockets as a group in Zigbee2mqtt. This works to some extent, but is not particularly useful in other aspects.
And if you do have to perform several in succession, you always have to insert a one-second delay in between.
Here is an example of my automation:

current Automation
alias: Haus verlassen -> bestimmte Plugs aus
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - zone.home
    below: 1
condition:
  - condition: state
    entity_id: input_boolean.stop_automations
    state: "off"
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.sonos_plugs
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.wohn_drucker_plug
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.wohn_media_plugs
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.schlaf_media_plugs
mode: restart
Why can't I do the automation like this?
alias: Test
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - zone.home
    below: 1
condition:
  - condition: state
    entity_id: input_boolean.stop_automations
    state: "off"
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.sonos_plugs
        - switch.wohn_drucker_plug
        - switch.wohn_media_plugs
        - switch.schlaf_media_plugs
mode: restart

Nevertheless, I still have the problem that sometimes Zigbee commands sent simultaneously from HomeAssistant are only partially executed.

For example in this automation(copys the states of light.wohnzimmer but only when my tv is off) i have a delay of 200ms which works perfectly most of the time, but sometimes didnt.
alias: Couch Lampe Controller
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.denon_avr_x4400h
    from: null
    to: null
  - platform: state
    entity_id:
      - light.wohnzimmer_lampen
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 200
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: media_player.denon_avr_x4400h
                state: "on"
              - condition: state
                entity_id: light.wohnzimmer_lampen
                state: "off"
        sequence:
          - service: light.turn_off
            data:
              transition: 1
            target:
              entity_id: light.wohn_couch_lampe
      - conditions:
          - condition: state
            entity_id: light.wohnzimmer_lampen
            state: "on"
          - condition: not
            conditions:
              - condition: state
                entity_id: media_player.denon_avr_x4400h
                state: "on"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.wohn_couch_lampe
            data:
              transition: 1
              brightness: "{{state_attr('light.wohnzimmer_lampen','brightness')}}"
mode: restart

Has anyone had similar experiences or found a solution to this problem?

Thanks in advance for your help!

My Setup:
Homeassistant in Docker
Zigbee2mqtt in docker ~ 70 Devices about 45 are Routers(mostly Plugs)
Conbee 2

I do simultaneous commands to many lights / switches without any delay in my automations and they work fine, both grouped together in HA (not Z2M) and without grouping. Are you using an extension cable for your coordinator?

Are messages being delayed, or not arriving at all? Or possibly arriving in the wrong order?

Please could you post your code as preformatted text (</> in the toolbar’s cogwheel menu).

yeah i have a usb extension cable 2.0

not delayed they are partially not executed
for example if I have 4 plugs in an automation sometimes only 2-3 are switched on

I expect you’ve read this…