-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
Service to suggest addons via generic IP scan #3920
Conversation
It feels to me like we are trying to shoe-horn the parameters for this into the existing schema. You may have noticed that the mdns discovery has an extra parameter in the schema. I would suggest to extend the schema for this. I think you should keep the check for the return value to be a pure regex (you can express hex numbers in a regex as well). All the others are not matching criteria, but input parameters. @andrewfg What do you think? In hindsight, we should probably have defined the mdnsServiceType parameter in the schema differently to make it more generalizable, something like:
That would be extendable without modifying the schema. |
Shouldn't we run this on a schedule and repeat it at regular intervals? The interval could be another configuration (next to switching this finder on/off completely). |
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
Thanks, Mark, for looking into this. I wanted to see it working first, changing the schema is probably something to consider, as the regex for input seems wrong to me as well. I am struggling a bit putting the scan from the getter function to task scheduled from the ctor... The list of candidates is now empty. I need to check later. |
@holgerfriedrich yup, the way that you mis- use the schema is definitely a horrible hack; but as a proof of concept this approach makes sense; however I still wonder if there are other add-ons other than KNX where such a network probe is useful. ?? |
@mherwege we would still have to modify (extend) the schema to support the new parameter(s) elements. But I get what you are saying about the extensibility. But we should wait until after v4.1 for this. Let is see whether other finders require a yet more sophisticated model. Note my draft for the USB device related bindings #3922 would not need extra parameters. |
46578d1
to
02dc3d7
Compare
KNX is not something you turn on and off, so I think it is fine to trigger it once at startup. |
This is probably a good idea.... Should we change it before this gets adopted in more places like the marketplace? |
That is also my thought. Better change it now before release than having to change it later and have a larger impact.
If we wait until after release, we could keep the existing mdnsServiceType for backward compatibility in the code but encourage the use of the parameter syntax. @andrewfg @kaikreuzer What do you think? This is not an immediate need, but will avoid some hassle in the future? Is there still time to do this change? |
Please do those changes before the release. In general I think this should also increase the version, but @kaikreuzer can probably comment on why we haven't done so in the past. |
@andrewfg I will create a PR to adapt core. |
@mherwege Ok I will check your core PR I will also do a PR for the developer docs |
Addon PR also created, changing all mDNS discovery definitions in the addon.xml files: openhab/openhab-addons#16060 |
02dc3d7
to
b63db40
Compare
Adapted to #3924, will not work without |
Afair, we did backward compatible changes in the past and therefore kept the version, so that there wasn't any need to update the xmls in the add-ons (and therefore keep e.g. the ones in the marketplace compatible). With breaking changes, we should probably indeed increase the version. But for #3924, it is imho ok to stick to the version as there hasn't been a release yet. |
Signed-off-by: Holger Friedrich <[email protected]>
Signed-off-by: Holger Friedrich <[email protected]>
Signed-off-by: Holger Friedrich <[email protected]>
b63db40
to
ded7540
Compare
@mherwege @andrewfg thanks a lot for your work on generalizing the schema! I have rebased to current master which contains the new schema. @mherwege @kaikreuzer Can you give advice what are the most important pieces missing right now?
@kaikreuzer What it the time frame this needs to be done? Are we too late for 4.1 already? |
@holgerfriedrich I am not a big fan of IP scans and all sorts of side-effects might occur here. I'd therefore prefer to not merge this as a PoC in the very last minute, but rather test it thoroughly after the 4.1 release is done. |
I get you point.... Though, IP scan sounds a bit more aggressive than it looks to me in this case: A single UDP frame to a well defined multicast addess and port. One frame sent during startup. And we can even disable it. |
ok, confirmed, did the restart too early.... it works when I wait longer. |
Signed-off-by: Holger Friedrich <[email protected]>
Signed-off-by: Holger Friedrich <[email protected]>
Signed-off-by: Holger Friedrich <[email protected]>
da9b908
to
73dc742
Compare
Signed-off-by: Holger Friedrich <[email protected]>
LGTM with refinements to be done for other IP finder scenarios. But this should not stop making this availalble already. |
@kaikreuzer Are we too late? Did you already trigger the milestone build? |
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 - just some logging improvement suggestions, then we are good to merge.
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
...scovery.addon.ip/src/main/java/org/openhab/core/config/discovery/addon/ip/IpAddonFinder.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Kai Kreuzer <[email protected]> Signed-off-by: Holger Friedrich <[email protected]>
Co-authored-by: Kai Kreuzer <[email protected]> Signed-off-by: Holger Friedrich <[email protected]>
Co-authored-by: Kai Kreuzer <[email protected]> Signed-off-by: Holger Friedrich <[email protected]>
Co-authored-by: Kai Kreuzer <[email protected]> Signed-off-by: Holger Friedrich <[email protected]>
Co-authored-by: Kai Kreuzer <[email protected]> Signed-off-by: Holger Friedrich <[email protected]>
Co-authored-by: Kai Kreuzer <[email protected]> Signed-off-by: Holger Friedrich <[email protected]>
done, thanks |
Signed-off-by: Holger Friedrich <[email protected]>
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!
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
@mherwege I looked into this because currently the Govee binding isn't detected. After doing some research these are the ways to find out if a Govee device is on the network
Do you see any way based on this implementation to auto discover the binding ? e.g. ``
|
Not at this point, but see #3936. We are looking to document different cases so we can make sure a more complete solution gets implementeren for 4.2. |
Thanks, let me know when I can try out something for #3936 or support you there. |
This is the implementation of a generic IP-based add-on suggestion finder.
It will try to discover add-ons by scanning the IP network with specific packages.
The description is taken from the metadata.
At startup, a single scan is done in a separate thread.
The finder can be disabled, as it actively sends packets to the network which might not be desired.
Example configuration:
for KNX we want to send a multicast package to 224.0.23.12 port 3671.
The section in
addon.xml
looks like this:Refs: #3912