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.68k stars 30.43k forks source link

Hue integration non-responsive when there is a HA upgrade ready #93440

Closed reiniertc closed 1 year ago

reiniertc commented 1 year ago

The problem

My hue integrations stops working when there is a HA upgrade ready to install. It resumed working after updating the HA-core.

"Stops working" means: lights are still available as entities, but the service lights.on , off or toggle are non responsive and the current status of the light isn't updated in HA. Automations using these services also don't work anymore (obviously). The Hue system itself (app and physical buttons) work fine and can control the lights. The bridge and its direct api also works.

"HA upgrade ready to install" means: In each case that my hue integration stopped working, there was an HA-core upgrade available to install under settings. This has happend at least with the five previous HA-updates. In every occasion, the solution was to update HA.

This is unwanted functionality, because now my system and its automations stop working unexpectatly whenever there is an update ready to install. So my presence simulation stops without notice when I'm not home for instance. There are no errors regarding Hue in the logs.

I'm on Home Assistant 2023.5.4 Supervisor 2023.04.1 Operating System 10.1 Frontend-versie: 20230503.3 - latest

What version of Home Assistant Core has the issue?

2023.5.3

What was the last working version of Home Assistant Core?

2023.5.4

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/

Diagnostics information

config_entry-hue-0fbe64a5e8e7f9453167c6c6a0add11f.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year 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!

Code owner commands Code owners of `hue` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign hue` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


hue documentation hue source (message by IssueLinks)

marcelveldt commented 1 year ago

This is an interesting issue as I have no clue how these two might be related. An HA update notification is in no way coupled with the connection state of the integration. I can't conform this issue myself, nor have I received any other reports about this so maybe there is some combination of factors in your situation we will have to look for.

A few questions:

1) Do you have any errors in the logs related to Hue ? 2) Do you have any automations that do something with update entitities or the fact that there's a HA update available ? 3) When you can no longer control your Hue entities, is there a warning/error noted on the integrations page within settings ?

reiniertc commented 1 year ago

I'm glad I'm not the only one that hasn't got a clue :-) I've waited a couple of months before posting the issue to analyse is and somehow it's very consistent: 1) in 100% of the occasions that there is a HA update possible, the issue happens 1) there are never any other issue with the integration than this issue.

The only error related to Hue in the log is AFTER the HA-upgrade (so when the hue integration works again):

Logger: homeassistant.bootstrap
Source: bootstrap.py:499 
First occurred: 06:41:09 (3 occurrences) 
Last logged: 06:43:20

Waiting on integrations to complete setup: raspberry_pi, adguard, mqtt, unifiprotect, sensor.ical, synology_dsm, zha
Waiting on integrations to complete setup: adguard, unifiprotect, synology_dsm, zha, homewizard, hue, unifi, forecast_solar, hunterdouglas_powerview, braviatv, icloud, hacs, calendar.caldav, dlna_dmr, netatmo, spotify, switch.adguard, home_connect, switch.unifiprotect, switch.unifi, switch.synology_dsm, switch.zha, switch.shelly
Waiting on integrations to complete setup: miele, mobile_app, esphome

I don't have automations that do something with update entities or HA-updates.

Also I don't see any warnings at the integrations page -> hue integrations.

Perhaps worth mentioning is that I also use the PowerCalc component, that adds sensor-entities per hue light-entity to calculate power usage. I don't see how that can be related, but one never knows.

marcelveldt commented 1 year ago

Powercalc does some pretty fancy things and hooks into all lights and even Hue directly. It can't harm to just disable that integration just as a test although many people run Powercalc in combination with Hue (myself included).

One more question: are there any other integrations that have the same issue ? So for example can you still control your shelly devices ?

reiniertc commented 1 year ago

The hue integration seems to be the only integration that has this behavior. Next time the hue issue comes back (I would expect that would be with the HA2023.6 update) I will disable the powercalc component to see if that makes any difference

reiniertc commented 1 year ago

Home Assistant Core 2023.6.0 is ready to install and the issue is back again (as always). This is a good time to do some researching before I upgrade and the issue disappears. First thing I tried: disabling the powercalc component: makes no difference.

I turned on the debug logging on the Hue integration, but nothing turns up in the logs when I try the automations with a Hue device in it. Before I upgrade the HA core and the issue resolves: is there anything more I can test/check?

edit: after a complete reboot of HA (without any upgrade) the issue is gone again. I guess I'll have to wait to the next HA update to do some more testing. Any suggestions in the meantime are welcome

marcelveldt commented 1 year ago

Well, you have disabled Powercalc after the fact so that would not make much difference. I was under the impression you already had it temporary disabled waiting for the 2023.6 release.

I'm a bit cluecless to be honest about this issue, you're really the only one ever reporting this issue :-) Looked several times at the code, nothing stands out. This has to be triggered by an external condition is my conclusion for now.

bramstroker commented 1 year ago

I just stumbled upon this issue by searching on powercalc in discord channel. I'm the developer of powercalc so I can chime in.

Powercalc does not have some direct connection or control to the Hue integration in any case. It only uses async_track_state_change to act upon state changes of hue entities. That's used all across the HA codebase and all helpers are using that as well. That method can't change entities in any way. So I'm highly confident disabling the integration will not solve your problem.

Anyway you got a very strange issue here. Also clueless and very hard to debug as you can only reproduce just before an update is ready to be installed.

reiniertc commented 1 year ago

@bramstroker cool that you took the time to react. I've ruled powercalc out of the options that could cause the issue. You are right: disabling the integration didnt solve the issue. Somehow restarting HA was enough to get the Hue integration going again.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

reiniertc commented 1 year ago

The issue hasn't occurred for some time now (at least 3 HA updates). I will close the issue, not knowing what I did to resolve it, but happy :-)