ZHA light state bounces and often not reflected accurately

Has anyone noticed that when lights are turned on or off that the state change is not reflected correctly in HA? When I turn off lights via the UI, the light actually turns off, but the state in HA bounces off and back on. Usually it just sticks at on after the first attempt and I have to just click to turn it off again (I’m assuming another Zigbee command is sent out) to make the state show properly. Sometimes I have to click it a few times in order to get it to properly show that the light is off.

If turning the light on, it usually correctly shows that the state is on, but it often gets the brightness state wrong - sometimes bouncing around before finding it, sometimes just never showing it correctly.

Alternatively, I have remotes paired with LL that control light groups directly, and when using those to turn the lights on or off or dim, the state doesn’t reflect in HA.

This seems to be more on the state of light groups, but I see it on individual lights as well.

I’m switching from Deconz to ZHA on Conbee II - Deconz was always accurate. Having the state bouncing around is tripping up some of my automations where I’m triggering on light state.

Nobody is seeing this?

I’ve not seen this behavior, but to me it sounds like your Zigbee mesh might be having issues passing state back to the controller. deCONZ is much better when it comes to abstracting things like this versus the native ZHA stack.

Is this with all your lights or just a few?

Seems like most if not all. Definitely more frequently on the zigbee groups than on the individual entities.

Sorry about the long delay; If it’s happening more with your groups versus individual lights, I’d recommend beefing up your mesh by adding some repeaters. Usually when you get strange things like this, it’s due to either a really low signal and/or bad signal quality. Adding some additional repeaters should help with that.

I’ve noticed this as well on 0.117… also using ZHA on Conbee II. I migrated all of my Philips Hue devices from Hue to ZHA. Can’t say how it was prior to 0.117, as I’ve only recently moved it all over…

In my experience, I turn off (or on) a group of lights and in real life the lights are turned on or off correctly, but in HA the state for the individual lights sometimes hang in the old state.

I’ve tried with both a normal group of lights as well as an actual ZigBee group, results seem to be the same.

As an example, I made some screenshots, these lights are less than 1m away from the controller:

The below is the initial state:
Initial

I then turn on the top entity, which in this case is a Zigbee group, notice how not all of the lights turned on:
turn_on

I then proceed to turn off the group. However, the group state jumps back to on, the state of one light does not change, while the rest all turn off.
turn_off

I then turn off the group again, and finally it goes back to the initial state. Which lights do / don’t reflect is totally random. It’s not specific devices.

Yes, that’s the type of thing I’m seeing. It’s a bit annoying. It also trips up some of my automation I have set to trigger on light state changing - since the state of the group initially flips to off, then bounces back to on, it triggers automation for those state changes.

If you leave it alone, it’ll eventually get the state correct since it occasionally polls the lights for their state and updates accordingly, but it should definitely do a better job of reporting the correct state as you’re turning lights on/off.

I’ve logged an issue for this.

Bumping this topic. Anyone find any fix for this issue? I’m using a ZHA light group with 12 different lights and they experience this same behavior. None of the advice in this thread or in the issue thread helped me resolve.

I appreciate any additional insight or suggested solutions.

1 Like

I’m having the same problem. Recently migrated from deconz and this is my only gripe until now.

I’ve always had this issue with ZHA. I have a node red sequence that checkes if a zha light group is on or off and then does different things depending on the state. If I turn the light off it takes a really long time for the zha group state to change to off. Can take minutes so it’s really unusable as condition. There has to be others that have the same issue. I noticed the issue that was posted earlier in this thread has been closed due to inactivity which is sad :disappointed:

I have the exact same issue. It’s making me rethink about the whole home assistant thing…

1 Like

I have what appears to be the same problem. My hardware is a Sonoff TX T2 WiFi Wall Switch and 24 Berennis (Magic Home) WiFi lightbulbs. I was able to work around it until hopefully the problem is corrected. The problem as I see it is that when the light group is set to “off” (no problem going to “on” for me):

the light group switch goes off,

some lights go off,

the light group switch returns to on,

the rest of the lights go off,

then the light group switch settles in the off position (this all happens in less than a second).

This makes it problematic to synchronize my physical switch with the light group. To get around this I used two automations to set the state of the switch based on the state of the light group and two automations to set the state of the light group based on the state of the physical switch. I created a light group status boolean that I used in the automations to set the switch / light group to “off”, I set the boolean to “on” then set the state of the switch / light group to “off”, waited 1 second and set the boolean to “off” again. In the automation to set the physical switch to “on” I added a second condition that the light group boolean had to be “off”. This allowed the light group states to settle in the “off” position, this was not needed in the automation to set the light group to “on”.

hmm, doubtful it is the same problem if you are using WiFi devices and not Zigbee devices like above?

I have the same problem, I’m desperate, and the colors of the scenes are not always correct. And Osram sockets respond badly.

Could colours not set correctly maybe be related to the two issues that @TheJulianJES is working on?

https://github.com/home-assistant/core/pull/74018

https://github.com/home-assistant/core/pull/74024

My PRs won’t fix the issue(s) mentioned here I think.

There was a PR regarding the jumping of sliders: https://github.com/home-assistant/core/pull/48777 but it’s currently not being worked on.

Regarding “colors of scenes not being correct”:

  • do the devices update their color?
  • when activating the scene another time, is the state then properly reflected in Home Assistant?

The jumping of the brightness slider should be fixed with 2022.8.0 (https://github.com/home-assistant/core/pull/74849).

This also delays polling ZHA group members by a second to make sure they’ve finished a default on/off transition (polling mid-transition would set wrong values).

What exact issues are left now?

I have the same issue. I’ve recently moved lights from both my Ikea hub and Hue hub to a Conbee II stick.

For testing purposes, I have created a light group with ~ 10 bulbs. When switching the group on/off all physical lights switch accordingly. But the state of one or more (random) lights is not updated.

Using Conbee II with latest HA Core and ZHA.

It appears that if I lower the number of lights in the group, it starts working better/fine. So far I think that having < 8 lights is not an issue. I have also tested using ZHA groups and other intermidiate groups but that also does not seem to resolve the issue.

Update 1: the test group is a mix of lights from the stick and some remaining on the Ikea hub.

Update 2: When the group has 4 hub lights and 3 stick lights there seems to be no issue. When switching to 7 stick lights, the issue arises again. Suspecting the number of Conbee ZHA lights in the group is the cause of the issue.

Update 3: Replacing 4 bulbs with 1 ZHA group reduces but NOT eliminates the issue. So the number of Zigbee signals from the stick went from 7 to 4 (3 bulbs + 1 group).

Update 4: Replacing the ZHA group with 1 bulb (so now 4 bulbs through ZHA in the test light group) still causes the issue.

Update 5: Replacing the 4 ZHA lights with 4 lights through the Tradfri integration completely removes the issue. So it’s not HA, but definitely the ZHA integration OR the Conbee stick. I would need to switch to Deconz or Zigbee2MQTT for further troubleshooting. But that will take me a lot more time.

I’m having what appears to be the opposite problem:

  • If I turn off a Zigbee2MQTT light group, it works.

  • If I turn off a HA light group, HA reports all lights in the group as off, but random (zigbee) lights in the group remain on.

I have about 60 Sengled bulbs connected to a Sonoff via Zigbee2MQTT, plus a handful of wifi bulbs and light switches connected through other integrations.

If I could create every group in Zigbee2MQTT, I would. However, that’s not possible given the mix of lights. (Also, it’s tedious that Z2M only allows for individual bulbs to be added to groups; there’s no way to nest groups within groups. For example, in Z2M I can’t make a “living room ceiling light” group, then add that group to a “living room” group.)

This has been driving me absolutely nuts, as for months I have been unable to turn off all lights when going to bed or leaving the house. Instead, this has been the daily process:

  1. Turn off all interior lights (via lovelace/automation/script/scene, it doesn’t seem to matter)
  2. See that HA thinks the lights are all off, but notice that lights are still on in reality
  3. Wander from room to room, turning the lights on and off again multiple times until they are really off