-
-
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
[danfossairunit] Use serial number as valid Thing ID in discovery #18414
Conversation
2c9f1e6
to
d4e0d61
Compare
Signed-off-by: Jacob Laursen <[email protected]>
d4e0d61
to
ec752ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM
Would be nice if @pravussum could comment.
Hej, the code changes LGTM so far.
|
No, they are from now on matched by the new representation-property for both old and new.
Only when manually discovering items. There does not seem to be a backgroudn discovery proces for this binding. |
Thanks for the review, and the others as well. 👍
This is handled, since the Thing handler already sets the
That's a really good question! I will test this some more. I did test it for manually triggered discovery while already having a connection from another openHAB instance, and here it will obviously fail when trying to connect. I'm afraid the same might happen for manually triggered discovery when already having the Thing online. In this case the discovery will be delayed by the For auto-discovery I need to check how often this might happen. I will get back after testing and thinking about how this might be improved. |
Auto-discovery is triggered only on component activation and when configuration for the discovery service is changed. So during openHAB startup I observed the discovery to be performed successfully quite some time before thing Thing came online (different start levels). Also it will be triggered when adding/replacing a JAR for the binding. So yes, it will request the serial number over and over again, but not very often. And no, it doesn't seem to be the case that it will fail the process under normal circumstances because OSGi component activation happens long before reaching the start level that will initialize handlers. |
I think actually that's a result of a lacking background discovery implementation: The binding does a one-shot discovery rather than continuously performing discovery until asked to stop: Lines 82 to 86 in 5a3a8bb
Usually bindings create a I'm not sure if background discovery makes much sense for this binding. I don't think it needs to same convenience as for example a Zigbee binding, where it could happen more frequently that new devices shows up after a trip to IKEA etc. |
This eliminates inbox results for already configured Things.
Additionally, the suggested Thing ID is now compliant with
.things
file configuration by avoiding "-" as first character in ID. See openhab/openhab-core#4652.A downside is that discovery now need to be able to connect to the unit to get the serial number. This is not possible while another connection to the unit is already established. However, the disovered Thing would not be able to come online anyway while such other connection exists.