Closed jaroslawp closed 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)
hue documentation hue source (message by IssueLinks)
I had to restart home assistant, guessing its a bug either with networking/intergration on HA. I could access Hue and PowerCycled it already, only rebooting HA fixed it (maybe a python network client bug?)
Broke a couple of hours later, I just set both the EdgeMax and Hue to static IP's I'll feed back if that helps. Does seem to be a unique bug to HA & Hue.
Do you have anything else running that does something with Hue ? Like homematic IP, Node red, custom integrations ? The Hue bridge indeed has a rate limiter but we keep to the limits, unless something else is also connecting to the bridge.
Just Home Assistant, only other thing is me using the App, I would hope that doesn't add to the limits?
For reference, rebooting the HA box (Virtual Machine) fixes it every time. Which makes me think it might be a HA/Python client bug not Hue? Unless Hue cuts off HA until it rebooted ? But it's all the same MAC and IP addresses so it's not like Hue would see a connection from a different client
I also had these errors in the log. Just setting the static Hue bridge IP in configuration.yaml seems to have solved it (of course you should make sure it is also set as static IP in your router).
Has been working flawlessly over two weeks now.
Op do 1 dec. 2022 19:08 schreef Christopher Jenkins < @.***>:
For reference, rebooting the HA box (Virtual Machine) fixes it every time. Which makes me think it might be a HA/Python client bug not Hue? Unless Hue cuts off HA until it rebooted ? But it's all the same MAC and IP addresses so it's not like Hue would see a connection from a different client
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/81641#issuecomment-1334157491, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATAPA2HNNM57FJKMKJGTZPDWLDSTFANCNFSM6AAAAAARYJ63AQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Yeah looks like setting static IP address on the router and hue seems to have fixed it...
Unfortunately this does not (entirely) fix it for me: I did set up static IP for the bridge in configuration.yaml, set up the bridge itself to use static ip (it was already getting a fixed ip assigned by dhcp before), performed bridge cleanup and power cycled it ...
it seems to be much better now:
After some more testing it does not really fix it for me at all ... the connection to hue bridge seems to be dropping every few seconds (it stays connected for about maximum of ~ 1m40s or so before dropping again)... not sure how can I debug this further ?
2022-12-15 10:11:46.527 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Connected to EventStream
2022-12-15 10:13:09.170 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 2 seconds
2022-12-15 10:13:11.181 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 4 seconds
2022-12-15 10:13:15.185 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 6 seconds
2022-12-15 10:13:21.190 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 8 seconds
2022-12-15 10:13:29.196 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 10 seconds
2022-12-15 10:13:39.200 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 12 seconds
2022-12-15 10:13:49.006 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Error while sending keepalive: Cannot connect to host 192.168.1.249:443 ssl:False [Connect call failed ('192.168.1.249', 443)]
2022-12-15 10:13:51.230 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 14 seconds
2022-12-15 10:14:05.234 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 16 seconds
2022-12-15 10:14:21.252 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 18 seconds
2022-12-15 10:14:39.259 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 20 seconds
2022-12-15 10:14:39.259 WARNING (MainThread) [aiohue.v2[192.168.1.249].events] 10 Attempts to (re)connect to bridge failed - This might be an indication of connection issues.
2022-12-15 10:14:49.011 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Error while sending keepalive: Cannot connect to host 192.168.1.249:443 ssl:False [Connect call failed ('192.168.1.249', 443)]
2022-12-15 10:14:59.268 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 22 seconds
2022-12-15 10:15:21.273 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Disconnected from EventStream - Reconnect will be attempted in 24 seconds
2022-12-15 10:15:45.415 DEBUG (MainThread) [aiohue.v2[192.168.1.249].events] Connected to EventStream
I have 2 Hue bridges and have never been able to reproduce this issue. So this could be related to the fact you're running in a virtual environment or you have some sort of rogue automation that is doing a lot of calls to Hue entities.
Our code is doing exactly what it should do: keep track of the connection and reconnect on failures.
BTW: Setting a static IP is no longer needed once this PR is merged and released: https://github.com/home-assistant/core/pull/85506
@marcelveldt : I believe I have found what caused the problem for me: it was the Nmap Tracker integration - after disabling it all went back to normal: interesting fact - I had both nmap tracker and hue both running since more than a year but the issue started to appear only few months ago ... perhaps some hue bridge firmware update and/or home assistant change in between triggered it. Thanks!
Well, in theory the nmap integration connects to devices in your network so in case of the Hue bridge this can affect the connection as Hue does not allow multiple simultane connections from the same IP since recent bridge versions.
The problem
Since few versions of home assistant the hue integration has problems connecting to the philips hue bridge: a reload of the integration helps to cure he problem - but only temporarily .. for few hours at most. This problem happened in the past (on all 2022.X versions of home assistant at least) but was far less frequent. I am aware of https://github.com/home-assistant/core/issues/73654 and https://github.com/home-assistant/core/issues/70086 which are marked as solved now .. but seems this may be little bit different (please see: Additional information)
What version of Home Assistant Core has the issue?
2022.11.1
What was the last working version of Home Assistant Core?
No response
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
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
It seems that for some reason hue bridge (v2 running 1.53.1953188020) is 'blacklisting' for some period of time the home assistant: when above problem occurs here is what I see:
from home assistant system:
wget -S --no-check-certificate https://192.168.1.249/api
Connecting to 192.168.1.249 (192.168.1.249:443) wget: can't connect to remote host (192.168.1.249): Connection refused
at the same time from other system on same network:
wget -S --no-check-certificate https://192.168.1.249/api
--2022-11-06 08:18:01-- https://192.168.1.249/api Connecting to 192.168.1.249:443... connected. WARNING: The certificate of ‘192.168.1.249’ is not trusted. WARNING: The certificate of ‘192.168.1.249’ hasn't got a known issuer.
[...]
2022-11-06 08:18:02 (48.6 MB/s) - ‘api’ saved [95]
this 'blacklist' lasts for ~ 1 minute and then again for ~ 1 minute I can perform above wget calls: the strange thing is it happens only from home assistant system (raspberry) I was not able to trigger this from my laptop ...
and after some more hammering of the bridge I was able to catch this error:
wget: server returned error: HTTP/1.1 429 Too Many Requests
and few requests later connection problem happened again.
I understand this may be a bug (or 'feature'...) of current bridge firmware - but perhaps introducing a (progressively growing) delay in aiohttp retries could make the integration more useable ? : at present when it gets in this state it does not seem to recover until I reload the integration in UI.