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
70.66k stars 29.52k forks source link

Philips Hue integration not properly reporting light states (continuation of #61819) #61926

Closed majkers closed 2 years ago

majkers commented 2 years ago

The problem

I still have my hue lights connected to bridge v2 wrongly reporting its state. It happens with Philips bulb with latest firmware and with 3rd party like IKEA ones. I did testing with quick toggling (ON and OFF) and with slow one. My zigbee sensors state is connected and light entities report state as ON but in fact they are OFF. Sometime after a long while they change by itself to proper one but it is rather random.

What version of Home Assistant Core has the issue?

2021.12.2

What was the last working version of Home Assistant Core?

2021.11

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Philips hue

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hue/

Example YAML snippet

N/A

Anything in the logs that might be useful for us?

Nothing in logs

Additional information

N/A

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

hue documentation hue source (message by IssueLinks)

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

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

TimBE1989 commented 2 years ago

I'm facing the same issue. States are out of sync.

HA showing the light on while the light is actually off. I only get them in "sync" again if I change something from the colors.

majkers commented 2 years ago

Changing something in android hue app forces sync as well.

marcelveldt commented 2 years ago

Some things to check:

majkers commented 2 years ago
TimBE1989 commented 2 years ago

Hi Marcel,

I can see two more people complaining in the main thread (https://community.home-assistant.io/t/2021-12-new-configuration-menu-the-button-entity-and-gorgeous-area-cards/365680/421)

majkers commented 2 years ago

Some more info here as well https://github.com/home-assistant/core/issues/61819#issuecomment-995138598

marcelveldt commented 2 years ago

I think I can reproduce the issue now. I will investigate.

golles commented 2 years ago

To me, it looks like the state is updated quickly in the UI when I change the light on/off in the HUI app. But when I try to turn off a light from HA, the light turns off, but the state remains on.

marcelveldt commented 2 years ago

Are some people able to turn on debug logging ? For both the hue component and aiohue library. That way we can see if indeed the bridge connection gets lost all the time.

In your configuration.yaml:

logger:
    default: info
    logs:
        homeassistant.components.hue: debug
        aiohue: debug
smonesi commented 2 years ago

(sorry for adding details to the closed issue!)

I did some experiment on my own, I changed the timeout (hardcoded in aiohue events.py to 10 seconds), I finally set it to 120 and...

Dec 15 20:53:25 fenix hass[1427315]: 2021-12-15 20:53:25 DEBUG (MainThread) [aiohue.v2[192.168.1.21].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
Dec 15 20:53:29 fenix hass[1427315]: 2021-12-15 20:53:29 DEBUG (MainThread) [aiohue.v2[192.168.1.21].events] Connected to EventStream
Dec 15 20:53:52 fenix hass[1427315]: 2021-12-15 20:53:52 DEBUG (MainThread) [homeassistant.components.hue.bridge.temperature] Received status update for sensor.sensore_giardino_temperature
Dec 15 20:55:30 fenix hass[1427315]: 2021-12-15 20:55:30 DEBUG (MainThread) [aiohue.v2[192.168.1.21].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
Dec 15 20:55:34 fenix hass[1427315]: 2021-12-15 20:55:34 DEBUG (MainThread) [aiohue.v2[192.168.1.21].events] Connected to EventStream

If I look at my previous logs, I see that the reconnections happened every 10 seconds, now every 120 seconds... I guess I'll fix my issue by setting the timeout to a very high number? 😄

marcelveldt commented 2 years ago

Oh my.... My fix from early today broke this. The 10 seconds is in fact applied to the entire connection and not only initial connect. There was a deadlock in there with timeout set to zero.

You can set it back to zero for now to have a stable setup. Please check how that works out. in the meanwhile I'm going to think about the chicken and the again situation. Not timing out the actual reading of events but no deadlock when initially connecting.... sigh

dshokouhi commented 2 years ago

i am also seeing this issue.

When i attempt to reload the integration the conneciton is kept for a few seconds then it quickly loses it again and i can no longer control the light.

2021-12-15 12:03:26 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:03:28 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:03:30 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:03:39 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:03:41 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:03:43 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:03:45 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:03:54 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:03:56 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:03:58 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].bridge] fetched 1 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].bridge_home] fetched 1 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].entertainment] fetched 2 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].entertainment_configuration] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].device] fetched 11 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].light] fetched 10 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].scene] fetched 6 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].button] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].device_power] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].geofence_client] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].light_level] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].motion] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].temperature] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].zigbee_connectivity] fetched 11 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].room] fetched 2 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].zone] fetched 0 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].grouped_light] fetched 3 items
2021-12-15 12:04:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:09 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:11 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 2 seconds
2021-12-15 12:04:11 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:13 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:13 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:15 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:24 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:24 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:26 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:28 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:28 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:30 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:31 DEBUG (MainThread) [homeassistant.components.hue.bridge.light] Received status update for light.front_door_lamp
2021-12-15 12:04:31 DEBUG (MainThread) [homeassistant.components.hue.bridge.grouped_light] Received status update for light.living_room
2021-12-15 12:04:32 DEBUG (MainThread) [homeassistant.components.hue.bridge.grouped_light] Received status update for light.living_room
2021-12-15 12:04:33 DEBUG (MainThread) [homeassistant.components.hue.bridge.light] Received status update for light.front_door_lamp
2021-12-15 12:04:33 DEBUG (MainThread) [homeassistant.components.hue.bridge.grouped_light] Received status update for light.living_room
2021-12-15 12:04:34 DEBUG (MainThread) [homeassistant.components.hue.bridge.grouped_light] Received status update for light.living_room
2021-12-15 12:04:39 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:39 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:41 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:43 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:43 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:45 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:54 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:54 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:56 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Disconnected from EventStream () - Reconnect will be attempted in 4 seconds
2021-12-15 12:04:58 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:04:58 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
2021-12-15 12:05:00 DEBUG (MainThread) [aiohue.v2[192.168.1.53].events] Connected to EventStream
LordAttilas commented 2 years ago

Issue is also causing motion sensor to not detect movement or stay in motion "Detected" status.

Just rolled back to core 2021.12.1 and motion sensor and light status are back to normal.

Thanks :)

marcelveldt commented 2 years ago

Please revert to 2021.12.1 if you experience this issue. This will still have a small issue but not as bad as this.

We'll provide a fix soon, thanks!

dshokouhi commented 2 years ago

@marcelveldt thank you for all your efforts in resolving everything, it is VERY much appreciated! Personally i can't rollback because then the app configuration menu will be hidden from non-admin users so i will hold off until the fix is ready :)

Nutti85 commented 2 years ago

I'm not seeing this issue with my V2 hub.

Model number: BSB002 Software: 1.48.1948086000 <- the Hue app reports this as the last known version

picotrain77 commented 2 years ago

I am experiencing the same issue with data in HA being out of sync. I have motion sensor reporting constant movement - with none taking place. If I toggle a motion sensor switch in HA the state of the switch jumps back a few seconds later as the switch is reporting off in HA but is actually on in Hue - therefore no push of state change from the bridge and no updating of the state in HA.

Restarting the addon and or HA appears to rectify the issue but only for a short time. I can force the issue to occur by simply toggling a motion sensor switch a few times in quick succession. Like others, all actions that take place via the hue app are instantly reported and shown in HA with lightning speed.

marcelveldt commented 2 years ago

Please do not report the same issue again. It's confirmed. You can temporary rollback to 2021.12.1 A fix will be on the way, thanks!!

picotrain77 commented 2 years ago

Please do not report the same issue again. It's confirmed. You can temporary rollback to 2021.12.1 A fix will be on the way, thanks!!

Sorry I didn't see that - my apologies

marcelveldt commented 2 years ago

Managed to fix it (this time for real haha). The fix will be in next bugfix release of HA.

picotrain77 commented 2 years ago

Thank you so much for your efforts on this @marcelveldt it is very much appreciated. Your a star ⭐️

marcelveldt commented 2 years ago

Reopened as reference for others not reporting the same issue.

srijken commented 2 years ago

Is this fixed in 2021.12.2, or will that be a later release? I'm still seeing this is 2021.12.2.

N1c093 commented 2 years ago

@srijken I think it will be in 2021.12.3.

Version 2021.12.2 was released before this bug fix.

TheFes commented 2 years ago

Is this fixed in 2021.12.2, or will that be a later release? I'm still seeing this is 2021.12.2.

@srijken 2021.12.2 was released Wednesday, Marcel commented that he fixed it yesterday and that it would be included in the next release. Simple math answers your question to "No, not fixed in 2021.12.2, yes it will be in a later (2021.12.3) release" BTW a few posts above yours it is mentioned that rolling back to 2021.12.1 solves the issue, so the issue is introduced in 2021.12.2

trunks403 commented 2 years ago

I have the same issue only i am not using ikea blubs but the lidl bulbs that give this problem

They bulbs give the wrong color and i when i turn them on after sec they turning off again in ha but they are still on

I have this problem since the release of 2021.12 and core-2021.12.2 the problem i still there

marcelveldt commented 2 years ago

@TheFes The issue already existed in 2021.12.0 and 2021.12.1 but got worse in 2021.12.2. So a rollback to .1 will make things a bit better but not 100%.

2021.12.3 will be released today in which it should be fully fixed.

@trunks403 Please open a new issue if you still experience issues AFTER the update to 2021.12.3 Thanks!

Nenodema commented 2 years ago

Thanks for your effort @marcelveldt really appreciate your work on this!

jentstemmerman commented 2 years ago

I also had troubles with this bug. Toggling a group of hue lights in HA would hang after 5-6 cycles. With 2021.12.3 I don't see the problem anymore.

Thanks!

Mithrox commented 2 years ago

Same here, everything seems good now after the update, thank you!

marcelveldt commented 2 years ago

Great to hear that the issues are now resolved, thanks for your patience!

tristanXme commented 2 years ago

Just did the upgrade to 2021.12.3 but sadly the states are still not correct.

marcelveldt commented 2 years ago

Just did the upgrade to 2021.12.3 but sadly the states are still not correct.

Can you open a new issue and exactly describe what is not correct ? I doubt this is the same issue as referred to in the issue.

tristanXme commented 2 years ago

The description matches 100% for me. I also use ikea bulbs and Original hue bulbs. State in the hue app is correct but its wrong at home Assistant.

marcelveldt commented 2 years ago

This is a closed issue. Please report a new one, exactly describing what issues you experience. With all lights or some etc ? Are you 100% sure you've updated to 2021.12.3 ?

You may want to enable debug logging to see a lot more info. See a bit above in this long issue report to see how to enable debug for the aiohue library.

Also, in general look in the logs if there are errors.