Lights react poorly since I connected my new Ledvance bulbs to z2m

Hi,

I had a large elaborate post butit got deleted cause an automation was triggered during troubleshooting

This post is the continuation of a reddit post I made in which I still had open questions.
I used to have all my lights connected to the Philips Hue bridge, Xiaomi Gateway for some wireless switches and z2m (+RaspBee 2) for some other stuff and it worked well. Since I bought these new Ledvance lights, connected them to z2m and included them in my “switch off all lights”-automations all lights react very slowly, if at all. They take 4-6s. I tried putting all devices on z2m, didnt help.

I tried the following Zigbee+Wifi Channel combinations with unsatisfying results:
Wifi Channel 11, Zigbee Channel 11
Wifi Channel 11, Zigbee Channel 25
Wifi Channel 1, Zigbee Channel 25
Wifi Channel 6, Zigbee Channel 25

What should I do now?

Do you use a Zigbee light-group or a HA light-group ?

by HA light group you mean those groups under “helpers”, right?
I tried both exclusively
unfortunately, they both had poor response times or ignored commands

I believe @francisp is asking if you can directly connect a zigbee light switch to the Ledvance lights using a Zigbee light group. This would pretty much eliminate all variables except wireless interference or a zigbee routing issue. Hard to tell from your description, however it sound like you might have problems in your Home Assistant scripts and automations rather than a zigbee issue.

‘I noticed Zigbee and wifi were both on channel 11’. Zigbee and wifi channel numbers do not correspond.

hi, ty for the response
if I understand correctly, a Zigbee light group is one made in eg the z2m group interface, right?

Also, are you sure the problem is within my automations/scripts when even a simple turn all lights on/off automation has this much delay all of a sudden?

One way to test if these bulbs are causing the problem is to temporarily remove them.

Yes, zigbee groups are documented here:
https://www.zigbee2mqtt.io/guide/usage/groups.html#groups

In reading your initial post, it appeared to me that you had a pretty complex setup of multiple zigbee networks. I would check the firmware version in your RaspBee 2 coordinator and your LedVance lights to see if there are any noted version issues on Zigbee2MQTT. You will be best served by review the discussion forums and github posts directly for Zigbee2MQTT, these have the largest universe of Zigbee2MQTT knowledge. Hard to follow your issues without more detail. Publish your automations (properly formatted) might help folks with ideas if there are problems there. How many lights are you talking about? Are they all on the Zigbee2MQTT network? What happens if you try to control just a single (one of ones you notice to be ‘slow’)? What about subset groups? Can you pool lights that seem responsive in one group and those that do not in another? and they try to control each group separately? What behaviors do you see?

Good hunting.

if the firmware version is under zigbee2mqtt>settings>about>coordinator version then I couldn’t find anything about it and the other things you suggested on Google.
I’ll try the Z2M forums later

An example of a 4s delay automation is:

- id: '1595176936601'
  alias: (bedroom) (daytime) button press -> lights on/off
  description:
  trigger:
  - platform: mqtt
    topic: zigbee2mqtt/lightswitch bed 1/click
    payload: single
  - platform: mqtt
    topic: zigbee2mqtt/lightswitch bed 2/click
    payload: single
  condition:
  - after: sunrise
    before: sunset
    condition: sun
  action:
  - data: {}
    service: light.toggle
    target:
      entity_id: light.all_lights
  mode: single

I’m controlling a total of 8 lights, currently on the same zigbee network (Zigbee2MQTT+Raspbee) just like the hand full of switches I have.

When I only toggle a single problem light with an automation almost like the above (just without conditions) by clicking the light switch it takes ~2s to respond with some clicks being ignored, same for the originally problem-free lights in this z2m setup.

During my testing process I had to pair my wireless light switch again because of connectivity issues from not being on the floor I was at when I originally paired them. (Someone told me the Aqara switches always pick the Zigbee route from when they were first paired and don’t change when they’re in a different location) And this changed the reaction time from 4s to 1,5-2s(, even for toggling all 8 lights just like in the automation before. Oddly, this was even the case when I re-paired another time in the floor that had the 4s reaction time and toggled it from there again. It all makes no sense to me)

After that I also tried:
Toggling 1 Hue Light (1 floor+2rooms away) connected to the Hue Bridge while the Xiaomi switch is connect to Z2M : 1,5-2s
Toggling 1 Hue Light (1 floor+2rooms away) connected to the Hue Bridge while the Xiaomi switch (2 rooms away from the bridge) is connected to the Xiaomi bridge: 1s

I noticed something: When I click on “Run Action” instead of using the wireless switch to toggle the lights it’s almost instantaneous. So perhaps the way I set up the button clicking trigger since recently is slowing the automation down too?
I tried some alternative triggers to see if I get better reaction times from them:

  • sensor.lightswitch_bed_1_click state
  • sensor.0x00158d0002ca2afb_action state

I’m not getting better reaction times upon using any of them though

I have one of the no neutral Xiaomi wall switches, link below, controlling 2 Cree zigbee bulbs, 1 Ikea zigbee bulb and 1 Sengled zigbee bulb. I do the control via the HA automation below. don’t get me wrong it is no blaze in responsiveness, however it is 1 second or less. As much as I like Z2M’s MQTT method, if you want speed, either settting up a direct zigbee light group controlled by a binding to a zigbee switch is the fastest. And yes, ZHA with it’s internal message model in HA is faster than Z2M going via MQTT.

As to your point on how Aqara switches connect, the no neutral Xiaomi Aqara switch I cited is connected to a 3rd Reality Smart Plug router that connects back to the USB connected TI CC2652P2 coordinator running 20211217 firmware revision. I am running Z2M 1.32.1.

I just unplugged the 3rd Reality plug that the Aqara switch was routing via and within 30 seconds it has re-routed via a Centralite wall switch and was turning on and off the 4 bulbs with no issues. I plugged back in the 3rd Reality plug back in and by the time I refreshed the Z2M map, the Aqara switch show routes back to coordinator via both the 3rd Reality and the Centralite plugs. The lights continue to turn on and off fine.

‘When I click on “Run Action” instead of using the wireless switch to toggle the lights it’s almost instantaneous. So perhaps the way I set up the button clicking trigger since recently is slowing the automation down too?’

This does seem to indicate the switch and/or the automation is introducing some type of ‘bad’ behavior. I cannot find it in any of my switch setting, however I seem to remember some switch behavior setting that you can set via Z2M’s options for devices (and general setting perhaps)

https://www.zigbee2mqtt.io/devices/WS-USC02.html#xiaomi-ws-usc02

I use some simple linux bash scripts such as shown below to monitor and send MQTT message to Z2M to help me understand messages and timing. You might find running something similar on a a machine, the ssh into the machine from a notebook while you stand in front of the switch and toggle it. As shown, the bash script below just prints out the MQTT messages from the Aqara switch as you press the top or bottom button:

user@ud-22-04-01:~/zigbee-test$ ./aqara-switch-master-bedroom.sh
Bash version 5.1.16(1)-release...
{"device_temperature":24,"elapsed":453077,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:09-07:00","linkquality":87,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"ON","state_top":"OFF"}
{"action":"single_bottom","device_temperature":24,"elapsed":634,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:09-07:00","linkquality":83,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"ON","state_top":"OFF"}
{"device_temperature":24,"elapsed":252,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:09-07:00","linkquality":87,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"ON","state_top":"ON"}
{"action":"single_top","device_temperature":24,"elapsed":623,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:10-07:00","linkquality":87,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"ON","state_top":"ON"}
{"device_temperature":24,"elapsed":234,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:10-07:00","linkquality":83,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"OFF","state_top":"ON"}
{"action":"single_bottom","device_temperature":24,"elapsed":606,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:11-07:00","linkquality":83,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"OFF","state_top":"ON"}
{"device_temperature":24,"elapsed":232,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:11-07:00","linkquality":80,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"OFF","state_top":"OFF"}
{"action":"single_top","device_temperature":24,"elapsed":555,"flip_indicator_light":"ON","last_seen":"2023-09-17T16:27:12-07:00","linkquality":87,"operation_mode_bottom":"control_relay","power_outage_count":4,"power_outage_memory":true,"state":"OFF","state_bottom":"OFF","state_top":"OFF"}
#!/bin/bash
echo "Bash version ${BASH_VERSION}..."

while :
do

    PRI=$(mosquitto_sub -C 1 -h 192.168.2.242 -t zigbee2mqtt/0x54ef4410006292fb)
    printf "%s\n" "$PRI"
#    echo $PRI


done

- alias: Master Bedroom Wall Switch Bottom On
  trigger:
  - platform: mqtt
    topic: zigbee2mqtt/0x54ef9510006ad2fb
    payload: 'ON'
    value_template: '{{ value_json.state_bottom | default(''NA'') }}'
  action:
  - service: light.turn_on
    data:
      entity_id:
      - light.master_bedroom_table_light
      - light.master_bedroom_dresser_light
      - light.master_bedroom_closet_light
      - light.master_bedroom_west_table_light
      brightness: 255
  mode: single

This script example just changes the LED colors on a gledopto zigbee LED strip controller a speed set by the ‘zdelay’ variable.

#!/bin/bash
echo "Bash version ${BASH_VERSION}..."

zdelay=0.25
echo $zdelay
while :

bright=$(shuf -i 0-254 -n 1)
#echo "brightness : $bright"
z="{\"brightness\": $bright}"
mosquitto_pub -t 'zigbee2mqtt/0x00124b001a066793/set' -m "$z"
for i in {1..20..1}
do
    red=$(shuf -i 0-255 -n 1)

    green=$(shuf -i 0-255 -n 1)

    blue=$(shuf -i 0-255 -n 1)

    z="{\"color\":{\"r\":$red,\"g\":$green,\"b\":$blue},\"transition\":0}"
    # echo $z
    mosquitto_pub -t 'zigbee2mqtt/0x00124b001a066793/set' -m "$z"

    sleep $zdelay
done



do
    for i in {150..500..10}
    do
        #echo "color temp : $i"
        z="{\"color_temp\": $i,\"transition\":0}"
        #echo $z
        mosquitto_pub -t 'zigbee2mqtt/0x00124b001a066793/set' -m "$z"
        sleep $zdelay 
    done
    for i in {500..150..-10}
    do
        #echo "color temp : $i"
        z="{\"color_temp\": $i,\"transition\":0}"
        #echo $z
        mosquitto_pub -t 'zigbee2mqtt/0x00124b001a066793/set' -m "$z"
        sleep $zdelay
    done



done


Good hunting!

And yes, ZHA with it’s internal message model in HA is faster than Z2M going via MQTT.

Perhaps, though I’ve read in a thread that ZHA doesn’t have the capability to set a short report interval like Z2M does. And since I need that for my thermostat and both integrations seem to use the same port on my RaspBee it looks like I need some kind of alternative solution.

I just unplugged the 3rd Reality plug that the Aqara switch was routing via and within 30 seconds it has re-routed via a Centralite wall switch and was turning on and off the 4 bulbs with no issues.

that’s true for your switch but I have another one. Mine is wireless and I immediately noticed more ignored inputs when I moved rooms despite having enough wired Zigbee devices in the same mesh which the thing could use to bridge the distance

I use some simple linux bash scripts such as shown below to monitor and send MQTT message to Z2M to help me understand messages and timing.

I wouldn’t really know what to look for in those messages. Also, I didn’t get how to run the script

Little update:

direct Zigbee binding isn’t sufficient to me because it’d conflict with my automations
I’m about to try the ZHA Toolkit addon though to have access to the costum report interval feature of Z2M I’m in need of