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:

I then turn on the top entity, which in this case is a Zigbee group, notice how not all of the lights turned 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.

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…

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?



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?