-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[hue] Hue bridge frequently added to the inbox #9357
Comments
I am not yet sure it has a direct link but trying to analyze the problem I discovered that the serial number in the discovery has letters in lowercase while the property set by the thing handler for the serial number has letters in uppercase. |
This is UPnP stuff which detects the hue bridge again and again. |
Confirming that I see the same thing. But I don't think it is new to OH3. On OH2 I had 'solved' the problem by reducing the log level on the hue binding from 'INFO' to 'WARN' :) however I think it would be proper to solve it properly in OH3.. I am 99% sure that the issue is due to a wrongly defined => I will have a look into it further in a day or two from now.. |
The log is coming from the core framework, not the hue binding. |
@lolodomo apparently your PR #9367 should have fixed this? However I am running the very latest SNAPSHOT of openHAB 3.1.0 (Build #2107) and I can see that #9367 has NOT solved the problem. And unfortunately, I can see that the #8810 fix is also apparently not working anymore (see below). So I guess that somebody has broken something else in the Inbox code. Or??
|
Maybe it is a regression from your own recent changes on Inbox ?? |
And maybe related to my issue openhab/openhab-core#1835 |
My PR #9367 was absolutely not fixing this "issue" but something else (the representation property of a bridge thing). I think we should log in the hue binding the object provided by JUPnP to see if there are differences. If not then we will have to search in JUPnP library or in the openHAB core framework to understand why the hue bridge is discovered again and again. |
The hue binding is not using mDNS but UPnP for its discovery service. |
Indeed. And? But let's just restrict our discussion to the Hue.. I have been watching my Inbox live onscreen over some time, and I can see the Hue bridge regularly appearing and disappearing (screen shots below). So not only is the bridge being added (as in the log), it is also being removed. If it were just a case of having a bad This is why I have doubts about |
In my case I see the issue with Hue and HP Printer -- albeit with different frequencies. The Hue uses UPnP and AFAIK HP uses mDNS discovery..
|
PS I don't experience the issue (that I referred to in my Issue report) anymore with the Velux hub. This is because the original OH JmDNS discovery was not reliably getting the data from the hub (dropped packets or something), so I ended up changing to a binding specific hard coded mDNS solution #8777 |
We have to understand why a new discovery scan is triggered and then why sometimes JUPnP is no more providing the hue bridge. When that happens, of course, the hue bridge thing will be removed from the inbox due to |
Both mDNS and UPnP use the UDP protocol. It is almost guaranteed that sometimes, a scan will not succeed. |
I am going to add few logs in the core framework (UPNP discovery service) to understand what happens. |
Therefore, I guess one solution would be to make discovery results more 'sticky' so that an occasional failure to discover a device does not automatically lead to it being deleted. Perhaps also it is worth noting that currently my Hue is running a mega "Hue Labs Colour Loop" for Christmas, which loads it quite highly, so it is probably dropping UDP packets more frequently. Or responding to them with a longer delay.. |
One thing I can see is that the timeout for the UPnP discovery is set to 5 seconds by the core framework. Maybe it is not enough. |
The UPnP Specification for the M-SEARCH discovery process specifies the MX: Required. Maximum wait time in seconds. Should be between 1 and 120 inclusive. Device responses should be delayed a So yeah I would say that 5 is a tad too low. :) |
But increasing MX is probably not sufficient. There will always be some results that get lost. So I suggest to add 'stickiness' so that results are cached for (say) 30 minutes.. |
As I guessed, the problem has nothing to do with openHAB but is a problem in JUPnP library (we can forget the OH timeout and removeOlderResults):
Look at the timing, JUPnP is notyfying the removal of the hue bridge and 3 seconds later its discovery. It looks like it is always the same pattern. PS: I have other UPnP devices like Sonos for example and they are not affected. |
Don’t get too hung up on this fact. As I say I have it now on HP Printer, and have also seen it before with earlier version of Velux. Also if the problem is in JUPNP then it might also be in JMDNS too.
Hmm. I would still suggest something like changing to removeOlderResults(now.minus(30 minutes)).. |
On my side, my priority is to understand what is wrong with the hue bridge discovery and to fix the issue (if there is really an issue we can fix). Maybe the issue is in the hue bridge firmware ? |
@andrewfg : don't hesitate to try removing |
You seem determined not to understand: removeOlderResults is intended to remove results that had previously been added to the Inbox. It does NOT have any function to prevent new discoveries from being added to it. So it certainly does NOT mean that the user has to wait for 30 minutes to see new results. The scenario is as follows..
The error we are seeing is because of step 3. above. If instead removeOlderResults(now) you called removeOlderResults(now - 30) then you would NOT get this error. It would smooth out the random disappearances of the device.. |
As I have said already many times: the problem is NOT unique to the Hue. But it certainly could be a problem in the hue firmware. It could also be a problem in our routers. Or a LAN interference problem. IMHO the issue is that sometimes, some devices, will fail to respond to a UDP search inquiry. This is an expected result. But certainly some devices will fail more often than others. Apparently the Hue is such a device. My point is that just one single failure, from time to time, should NOT be a reason to chuck out a device from the Inbox. Since the chances are NOT that the device has permanently disappeared. But rather that the device has undergone a temporary lack of response to a specific search inquiry. Which is normal. |
I am not alone, on your side, you seem determined not to understand that in my scenario, openHAB is never starting a new scan, it only listens to changes from the JUPnP library. This is what I verified withj my added log entries. What your are talking about is a different problem, something that could happen when openHAB is starting a manual scan because the user requested it in UI. I don't say there is nothing to do with that, I just say that it is not the cause of MY current issue with the hue bridge described in this page. What you are talkiong about (temporary hidden UPnP device) is I think something that should be handled (if not yet done) by the JUPnP library itself. |
We should also check again if the behaviour is different in OH 2.5. I believe it is but it would be better to verifiy again to be certain. |
@kaikreuzer : could you please confirm what are the changes in the JUPnP library between the one included in OH 2.5 and the one now included in OH 3 ? Is it only a compilation with Java 8 vs Java 11 ? Any other dependency in JUPnP was updated ? No change in code ? |
Ok. So I think you are saying that JUPNP calls Quote from the jdoc of
UPnP discovery actually comprises two sub-functions -- namely NOTIFY 'alive' (device unilateral multicast notification), and M-SEARCH (finder multicast query, device unicast response). If you think there is a problem in JUPNP then we need to debug which of these two sub-functions is actually failing (especially in the case of the Hue).
|
I have been running Wireshark to trace UPnP SSDP 'alive' notifications and compare them to OH Inbox logs. See the example below.
|
^ |
With my OH 2.5.9 server, this problem does not occur. So it seems something that appeared with OH3. Maybe something went wrong in the JUPnP library... PS: my OH3 server is still connected to Wifi, I will move to a wired Ethernet connection to see if it changes something ! |
Mine too. Obviously over a (part) wifi link there is a higher risk of UDP packets being dropped. But my Wireshark measurements indicate the hue sending packets late rather than packets being dropped. PS the upnp spec requires devices to send several repeat packets just in case; but AFAIK the hue is not sending repeats.. |
Connecting my openHAB server to Ethernet (wired) rather than using Wifi solved the problem. So I close this issue as the issue is not directly in openHAB code. An issue could be opened in JUPnP library to explain that the library is not fully reliable when used from a Wifi connection. |
Connecting to Ethernet did NOT solve it for me :( ..
|
@lolodomo fyi.. |
Hi there, Its look like I have the same issue with the HUE gateway added to the inbox |
@hansie8888 thank you for your feedback; it confirms that at least three people have experienced the issue, so there is really something needing to be addressed. The following summarises the findings of @lolodomo and myself..
|
In fact, I believe it should be handled by the JUPnP library, that means not in openHAB at all, neither core nor binding. |
@lolodomo I don't agree with you; the UPnP specificaton is quite strict in that if a device fails to send ssdp:alive in due This CODE is how I would suggest to do it. |
Don't hesitate to propose your change. It will be reviewed and commented by oh core framework maintainers. |
|
OH3 snapshot 2066.
Looks strange to have the hue bridge frequently added to the inbox. I would expect it to be added only once.
The text was updated successfully, but these errors were encountered: