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
69.71k stars 28.87k forks source link

Hue bridge not connecting anymore? #75996

Closed jlm70 closed 1 year ago

jlm70 commented 1 year ago

The problem

I've two Hue Bridges in my home network, one in the house (10.0.1.150), one in garage (10.0.1.151). Both connected to the same mesh network. They've always worked fine. Since a couple of days my "home bridge" does not connect anymore. I get the message: "Retrying setup: Error connecting to the Hue bridge at 10.0.1.150 (33 devices, 10 services and 134 entities)

As you may imagine, I'd rather not delete and reinstall the integration, 'cos I spent so much time in reorganising lights, renaming them, etc.

In the log file I only find this entry: 2022-07-31 20:09:22 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hue Bridge 001788227e91' for hue integration not ready yet: Error connecting to the Hue bridge at 10.0.1.150; Retrying in background

The Hue app on my iPhone/iPad works properly, as always: I can connect to both my hue bridges with no problems.

What I could do to better address and solve the issue?

What version of Home Assistant Core has the issue?

Home Assistant 2022.7.7

What was the last working version of Home Assistant Core?

Home Assistant 2022.7.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Philips Hue

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?

In the log file I only find this entry:
2022-07-31 20:09:22 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hue Bridge 001788227e91' for hue integration not ready yet: Error connecting to the Hue bridge at 10.0.1.150; Retrying in background

Additional information

No response

probot-home-assistant[bot] commented 1 year ago

hue documentation hue source (message by IssueLinks)

probot-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! (message by CodeOwnersMention)

marcelveldt commented 1 year ago

1) Can you compare software versions on both bridges ?

2) This may sound obvious but in 99% of the cases this means that HA is unable to connect to the bridge (so, network error). Start by checking cables, restart the router and/or switch.

3) Do you have any other services connecting to the bridge such as Node Red etc. ?

4) Do you have any automations that do a crazy amount of calls to the bridge ? We've noticed that the bridge starts blocking a client when it makes too many connections/calls.

5) Start by simply restarting the hue bridge. Power off - wait a bit - power back on. And yes, the Hue app may work fine while other external connections do not for reasons I explained above, the bridge may be actually rate limiting your HA IP or the session just got stuck.

jlm70 commented 1 year ago

Ciao Marcel, pls excuse but currently in vacation and accessing the home network and HA remotely. Hub 1 is 1.52.1952154030 (IP 10.0.1.150) - currently not working in HA, works ok in app from remote. Hub 2 is the same 1.52.... (IP 10.0.1.151) - currently working in HA, but does NOT connect from remote.

Hub1 works via internet from my Hue app, while Hub2... now cannot connect via Hue app (it worked in the past). The exact contrary with HA app: Hub1 does not work, Hub2 yes...

If I connect via VPN (Wireshark) to my home, via mobile phone, I can access BOTH bridges via Hue App. So - probably - there's a problem with the Philips REMOTE connectivity? But... isn't HA in local push with Hue?

I've still no automations done with my lights: the only ones are "out of HA". I mean, with the Hue Motion sensors I drive some scenes to switch on/off. And I've several Hue switches too. If I connect to the Philips Hue website... I only see the bridge that does NOT work with HA, while I do NOT see the second bridge... that works with HA...

I did try switching off the bridge (was one of the first tries), but... no luck.

This seems so strange...

marcelveldt commented 1 year ago

I'm sorry but i can't help with this issue as it seems to be network related. Hue discovery relies on zeroconf so your bridge needs to be in the same network as the HA machine. There's a fallback discovery in place using the cloud but I'm not so sure if that survives both multiple bridges and different subnets.

HA only connects to the bridge locally, while the Hue app has a special remote connect feature where the connection to the bridge is relayed through the cloud.

jlm70 commented 1 year ago

Both my bridges are in the same subnet mask: they share the same mesh (ethernet), and are in the same network as HA… and indeed they worked both, up to (I think) a HA update (I was wrong initially to automatically update HA with no particular care - my fault).

Anyhow… given HA connects locally… I agree that it “should” be easier to debug: but being new to HA… any advice in how to debug this connection, where to look for an eventual log, how to empower a verbose mode… would be vary helpful. Many thanks

user0x01 commented 1 year ago

Me too. I had to move Hue for HA to make it usable again.

Odroid C2 with ETH0 and WLAN0. HA-Hue now only works in ETH0, no longer in the WLAN0 segment.

Home Assistant 2022.8.4 Supervisor 2022.08.3 Operating System 8.4 Frontend 20220802.0 - latest

balloob commented 1 year ago

We've seen once that Hue was broadcasting the wrong IP from zeroconf, which caused Home Assistant to update the wrong IP address. Subsequent connections then didn't work because it would connect to the wrong IP.

@marcelveldt we should update the Hue diagnostics to include the bridge IP (also for v1 hubs). From a quick glance, the diagnostics assumes currently the config entry is set-up, which is also not always the case (like this case where we can't connect) (This is wrong)

jlm70 commented 1 year ago

Thanks @balloob! And do you know how to solve or verify the issue? This might really be the problem... How to change the IP in HA without deleting and reinstalling everything (I've 33 devices, formerly configured, with scenes and 122 entities...): where is this parameter written?

marcelveldt commented 1 year ago

Just power cycle the bridge... what we've seen in the past is that the bridge sometimes broadcasts its old ip on zeroconf (or ssdp?) after the dhcp address changed. To prevent this, just assign a static IP to the bridge in your router.

jlm70 commented 1 year ago

Mmmmh... unluckily... this was already done: my two Hue bridges have been fixed in the router (Firewalla Gold) since day one... 10.0.1.150 and 151. Maybe I did change the device name in the router (local domain name, such as iot.philips.hue.lan), but this shouldn't affect in any way the IP...

marcelveldt commented 1 year ago

Something else connecting to the bridge perhaps such as Node Red, Homematic IP ?

Are the bridges on the same network? No firewall in between ?

jlm70 commented 1 year ago

No other platform, such as NodeRed, connected. And yes, as stated above, same network, no firewall in between: my Firewalla Gold is acting as router and firewall vs external, no blocks on domotics.

balloob commented 1 year ago

You could check the mDNS data Hue is sending out on your network to see if it's the right IP. They publish under _hue._tcp.

marcelveldt commented 1 year ago

Could it be that the user is deleted from the bridge so HA is no longer allowed to connect. Looking at the log again the discovery is not the issue because the connection is attempted at the correct IP and you've set them static so there has not been any IP change.

It doesn't hurt though to check the mDNS info that is being broadcasted. You can use any Zeroconf/Bonjour discovery app for that.

So far I've only seen this issue in case of the bridge actively denying requests after it being overloaded. A simple power cycle was sufficient to recover. In your case you say you did power cycle but it still can't connect... That makes me think... We have some guards in the code to detect the authentication issue that may occur when the username is deleted but now I'm not so sure if we ever tested it against the V2 api...

I'll do a quick test here to confirm. If that is the case and our detection fails, a re-auth will never be triggered.

Other than that I do not have any options left what the issue might be. Network is straight-forward so we can rule that all out and you have power cycled the bridge.

jlm70 commented 1 year ago

Yes, I did power cycle with no luck. It was probably my very first guess. Unfortunately I cannot retry again now, 'cos... I'm 600km distant from home. But I can remotely enter in VPN and make other verifications, where needed. I didn't know about the mDNS potential issue... maybe we've found (=you:) the cause... Waiting to know for... my next step. Super thanks!

user0x01 commented 1 year ago

Me too. I had to move Hue for HA to make it usable again.

Odroid C2 with ETH0 and WLAN0. HA-Hue now only works in ETH0, no longer in the WLAN0 segment.

Home Assistant 2022.8.4 Supervisor 2022.08.3 Operating System 8.4 Frontend 20220802.0 - latest

Something disabled IP4 in HassOS Network config on Wlan0. After switching to DHCP everything worked again.

marcelveldt commented 1 year ago

@jlm70 we're out of options unfortunately. The communication between HA and the Hue bridge is disturbed and like I said in all cases I have seen so far this was related to either network issues or the Hue bridge just denying requests from HA.

Maybe power cycle it again just to be safe ? (power cable out, wait 10 seconds, power cable back).

jlm70 commented 1 year ago

Ciao Marcel, First of all… thanks for kindness and support. End of month, as soon as back from vacation, I’ll try again cycling it, incl. capacitors discharge. And let you know. From where I’m now… can only access remotely in VPN, eventually look for logs, but not power cycle. Thanks again and… news soon. Best

jlm70 commented 1 year ago

Dear friends, back from vacations and finally close to my HA ;-) I tried DELETING the problematic Hue Bridge integration, keeping only the working bridge. Now I find tens of non available entities: I thought that deleting the bridge integration would have deleted related entities: I'll try to do that manually...

The NEW PROBLEM: I was hoping that HA would have now found again my bridge (same network, perfectly working with hue app, remote accessible, etc.), so to add again all of my lights. I tried to update HA to latest core/so, to restart many times, to restart the HUE bridge, to press its button... nothing :( Why cannot anymore add the Hue Bridge? How to do it manually? Selecting Add / New Device / Hue... HA finds nothing new.

My secondary HUE bridge still works with no problems in HA.

Any new ideas?

jlm70 commented 1 year ago

Wow. Without doing ANYTHING to my two Hue bridges and related network addresses, after my last HA update to 2022.9.4 (from 9.1)… as a miracle HA rediscovered my first disappeared bridge. Boh… cannot understand the reason... but in any case… problem auto-solved 😄 Hopefully it will last ok. 🤞🏻

RenewedMe commented 1 year ago

I experience the very same issue. I moved both the Hue bridge and the HA server to a new location in my house, started them up and since then I get the message "Retrying setup: Error connecting to the Hue bridge at ...". As above the iOS Hue app still works as before. Both the Hue bridge and the HA server are on the same subnet, linked to the same switch with no firewalls between. I am using Home Assistant 2022.9.7 Supervisor 2022.09.1 Operating System 9.0 Frontend 20220907.2 - latest

I have no other services like Node Red connected the the Hue bridge. Have a limited nr of automations but doubt they could overload the bridge as they are infrequent and did not cause any issue before. Tried restarting the. bridge to no effect. Tried reinstalling the integration but after pressing the bridge button and then clicking submit I get an "unknown error".

So my case looks the same as jlm70 describes above. Any suggestions as to what I should try?

samsonusmc commented 1 year ago

I am having the same issue that started at the same time (same release). Hue bridge and HA on the same network and switch. Removing and re-adding the connection fixes it for a short time, but this is unsustainable.

marcelveldt commented 1 year ago

I am having the same issue that started at the same time (same release). Hue bridge and HA on the same network and switch. Removing and re-adding the connection fixes it for a short time, but this is unsustainable.

You should not have a need to remove and re-add the integration, ever. What I find strange is that most people do not have this issue and it only happens in a few cases, maybe routing/network related is something that pops in my mind.

Things to try if this happens (HA loose connection to HA bridge):

1) Unplug power from the bridge, wait minimal 10 seconds and apply power back. 2) Restart/power cycle your router. 3) Restart Home Assistant. 4) Assign a static IP to the Hue bridge (or the other way around, change it to DHCP).

Do not apply all these things at once but try them out one by one. Also it would be nice to get some details about your setups like router brand and such so maybe there's a clue there.

RenewedMe commented 1 year ago

Thx for your thoughts Marcel. I followed your suggestions one at a time and in the sequence you mentioned (in step 2 I also rebooted the switch to which both HA and the Hue bride are connected) but regret to say that these did not address the problem.

My network is based on Unifi version 7.2.94 with a UDM router running UniFi OS UDM 1.12.30 and a US-8-150W with running 6.3.13. Note that in the mean time I have upgraded HA to: Home Assistant 2022.10.2 Supervisor 2022.10.0 Operating System 9.0 Frontend 20221006.0 - latest

samsonusmc commented 1 year ago

Interestingly enough I also have Unifi Networks with the same problem. Very similar versions...but if there were network issues, I'd imagine I'd have issues with my Samsung Hub, Hubitat Hub, Brilliant switches which all are communicating with the Hue Hub without issues. Only HA disconnects.

The error is simliar to below with the following in the log. Rebooting the HA hub almost always fixes it for about an hour or two.. then it breaks again... Thinking of making an automation to reboot the hub to address this in the short term.

image image
samsonusmc commented 1 year ago

more information... is there a a rate limit issue since I have so much talking to the Hub?

File "/usr/local/lib/python3.10/site-packages/aiohue/v2/init.py", line 182, in request aiohue.errors.BridgeBusy: 25 requests to the bridge failed, its probably overloaded. Giving up.

File "/usr/src/homeassistant/homeassistant/components/hue/bridge.py", line 123, in async_request_call File "/usr/local/lib/python3.10/site-packages/aiohue/v2/controllers/scenes.py", line 31, in recall File "/usr/local/lib/python3.10/site-packages/aiohue/v2/controllers/base.py", line 159, in update File "/usr/local/lib/python3.10/site-packages/aiohue/v2/__init__.py", line 182, in request aiohue.errors.BridgeBusy: 25 requests to the bridge failed, its probably overloaded. Giving up. File "/usr/src/homeassistant/homeassistant/components/hue/scene.py", line 142, in async_activate File "/usr/src/homeassistant/homeassistant/components/hue/bridge.py", line 132, in async_request_call 2022-10-10 14:05:10.118 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hue Bridge <SN>' for hue integration not ready yet: Error connecting to the Hue bridge at <IP>; Retrying in background 2022-10-10 14:07:04.550 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hue Bridge <SN>' for hue integration not ready yet: Error connecting to the Hue bridge at <IP>; Retrying in background 2022-10-10 14:08:47.776 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hue Bridge <SN>' for hue integration not ready yet: Error connecting to the Hue bridge at <IP>; Retrying in background 2022-10-10 14:11:03.360 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Hue Bridge <SN>' for hue integration not ready yet: Error connecting to the Hue bridge at <IP>; Retrying in background

RenewedMe commented 1 year ago

Hmmmm.... interesting. Now that I assigned as per Marcel's suggestion a fixed IP address to my Hue bridge I figured that I no longer need a fixed port profile for the switch port connected to my Hue bridge as I indicated that the Hue Bridge should be part of my x.x.50.x VLAN when assigning in the fixed IP address. When I then restarted the Bridge it got a new IP address; not the one I assigned but a x.x.3.x address. Not sure what caused that but that is more of a Unifi issue. However the amazing thing was that now my Hue Bridge works again in HA. When I reverted back to activating the port profile I used before I once again couldn't link HA to the Hue bridge. I looked at the VLAN settings but can not see any difference between the settings of more default LAN x.x.3.x and my x.x.50.x VLAN; very strange. For now I decided to have both HA and Hue Bridge in my default LAN (i.e. not on a VLAN) and that appears to work. Will keep you posted.

marcelveldt commented 1 year ago

I think it's an issue with the mdns reflector of Unifi. I have a Unifi setup myself too and in the end dropped the multiple VLAN's because it was causing too many issue with consumer-grade hardware and their multicast traffic.

For example the Hue bridge uses both SSDP (legacy) and zeroconf/mdns (new style) to broadcast its presence (and Ip details). Home Assistant supports both discovery protocols because V1 Hue bridges still use SSDP while V2 bridges should only have zeroconf and according to Signify we should no longer rely on SSDP as it's being passed out.

My own network is Unifi too with UDM Pro and actually 2 Hue bridges and I never have these issues but like I said before I did experience issue like this when I had all my IOT gear on a separate VLAN. In the end I settled on an intermediate solution where stuff like the Hue bridges and the Chromecasts are on the main VLAN.

Unifi does have a multicast forwarder built-in but its performance is a bit hit and miss imo, so that could explain the trouble. Good chance that HA just receives the wrong discovery info from the Unifi mDNS responder/forwarder and is plain simple just connecting to the wrong IP. At least, that is my theory.

samsonusmc commented 1 year ago

I was worried about this so all my Hubs are on the same VLAN and I don't have any multicast forwarding enabled. I'd be interested to hear how @RenewedMe fairs with his hub. Also I have 51 devices.. not sure if that was a problem or not.. I saw an old bug where that was a question

RenewedMe commented 1 year ago

@samsonusmc after changing the Hue Bridge and the HA server to my default VLAN, as described above, the link has been stable for the last 24 hrs. Reading Marcel's reflections it looks indeed that this is an issue unique to the combination of Unifi VLANs (other than the default one) and the Hue Bridge.

chrisjenx commented 1 year ago

Interesting, everything for me is on the same (IoT) VLAN, HA could ping and see Hue, the only thing that got it working again was a reboot of the HA host... maybe a lower level HA OS networking bug? No addresses changes, no switch reboots/updates, just randomly wouldn't connect. What's odd is never seen this with other network devices (PowerView/Cameras/Unifi) This did happen a couple of hours after a HA update, makes me wonder if the "restarting" of HA isn't always smooth and should just do a full reboot of the host?

chrisjenx commented 1 year ago

So yeah on top of my post yesterday, seems like I'm now stuck in the, fixed for a couple of hours or so until it breaks again. I just set a static IP address in my EdgeRouter and on the Hue Bridge... we'll see how that fairs.

chrisjenx commented 1 year ago

Been stable a couple of days now since setting static ip... guess there is a weird bug with ssdp/mDNS