home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.69k stars 30.44k forks source link

zha group status does not update appropriately #70094

Closed janrg closed 2 years ago

janrg commented 2 years ago

The problem

It seems like this is might be the same issue as https://github.com/home-assistant/core/issues/36767, but I haven't been using HA for long enough to know if it's a regression or a case not covered by the fix. I have my lights set up in zigbee groups via /config/zha/groups connected to a ConBee II Let's say I start with all the lights on. I then toggle the group and all lights turn off correctly. However, some of them don't change their state to off and I'm assuming because of this, the group switches its reported state back to on about a second later. If I now try to toggle again, the first toggle switches the group back off and only a third toggle turns it back on. The state does not appear to correct itself, but this typically takes on the order of several minutes and until it happens, a toggle doesn't work as it's supposed to. I've observed this behaviour with both Hue and Tint bulbs, though the Hue bulbs seem to be slightly worse.

What version of Home Assistant Core has the issue?

2022.4.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

ZHA

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @dmulcahey, @adminiuga, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


zha documentation zha source (message by IssueLinks)

dmulcahey commented 2 years ago

Can you attach diagnostics for the integration and the bulbs in one of the groups please. Also, enable debug logging and attach the logs. We’ll need the entire interaction. Toggle the group and wait about 60 seconds. Attach everything generated during that time please.

janrg commented 2 years ago

zha-a0c07df10f2448c6f9e939f373c02e49-Signify Netherlands B.V. LCT015-81e33450a4d74927a41fb15d66f2b373.json.txt zha-a0c07df10f2448c6f9e939f373c02e49-Signify Netherlands B.V. LCT015-458749c57f6a5c5f3d1bf825ae7aa206.json.txt zha-a0c07df10f2448c6f9e939f373c02e49-Signify Netherlands B.V. LCT015-b4fb465afd9d03c7a12c0b83a7ac1cb8.json.txt zha-a0c07df10f2448c6f9e939f373c02e49-Signify Netherlands B.V. LCT015-cebb8eb5eae2d5e6b11dcba021f7205a.json.txt config_entry-zha-a0c07df10f2448c6f9e939f373c02e49.json.txt zha-a0c07df10f2448c6f9e939f373c02e49-Philips LCT015-93745219d65d52cefdbecf84d56b22d9.json.txt zha-a0c07df10f2448c6f9e939f373c02e49-Signify Netherlands B.V. LCT015-8baf7cff6b7c82f0f05a44a2b5b80cd0.json.txt

Here are the diagnostics files. For the debug log: is there a condition by which I can filter the logs before attaching them, e.g. only include lines containing the string "light." to cover anything referencing the lamp or group entities? The 60 second log file is 3.4MB and thus way too big for me to check whether it contains any PII :-)

dmulcahey commented 2 years ago

I need all the logs from zha, Zigpy and the radio library.

janrg commented 2 years ago

log.txt I hope this contains everything you need. Please let me know if I can provide anything else that would help.

dmulcahey commented 2 years ago

99% of the zha logging is not here… can you share your logging config?

janrg commented 2 years ago

Oh, apologies, that was my mistake when filtering the logs. Is this better log.txt ?

dmulcahey commented 2 years ago

Why is permit joining constantly running? You can find me in the HA discord server… it may be easier to talk about this there.

dmulcahey commented 2 years ago

Oh, apologies, that was my mistake when filtering the logs. Is this better log.txt ?

Not really. How are you getting the log? you aren't using the device joining screen are you?

janrg commented 2 years ago

Taking the homeassistant.log and then running it through a script I just wrote to try to filter out the irrelevant / PII containing stuff. The script might still be filtering out too much. I'll try to come into discord in about half an hour if you're still there then.

janrg commented 2 years ago

I'm in discord but can't find you :-)

dmulcahey commented 2 years ago

I’m in the HA server with the same handle. Post in #zigbee and I’ll ping you

dmulcahey commented 2 years ago

We worked through this. The cause is very similar to #40300. we were able to prevent the issue seen in the group entities in question by changing the debouncer here: https://github.com/home-assistant/core/blob/f8367d3c01e8eb786e8f742f70614c8aebf82354/homeassistant/components/zha/entity.py#L302 to use an obscenely large number.

I am not sure what the best approach is to fixing this. when bulbs follow the spec things just work. These are Philips LCT015 bulbs that don't report state changes. From all of the logs we can tell the bulbs respond to the polling after a group command but there is a very noticeable delay after 4 of the 6 are polled which causes the time on the debouncer to expire which updates the group entity. The lights that comprise the group are in varying states in the state machine because all bulbs haven't responded to the polling. As a result the group entity changes its state. Waiting inevitably corrects the state when the remaining bulbs finally reply to the polling but that isn't a great experience.