[knx] Skip already discovered Things during device discovery#19828
[knx] Skip already discovered Things during device discovery#19828holgerfriedrich wants to merge 2 commits intoopenhab:mainfrom
Conversation
Prevents reconfiguration of imported Things when discovery runs. Previously, existing Things were rediscovered and reconfigured to default connection type. Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
| private final Logger logger = LoggerFactory.getLogger(KNXnetDiscoveryService.class); | ||
|
|
||
| private @Nullable Future<?> scanFuture = null; | ||
| private final ThingRegistry thingRegistry; |
There was a problem hiding this comment.
Afair, discovery services should not have a dependency on the thing registry.
Anyhow, I do not think this is the right approach, see also my comment at #19824.
|
@kaikreuzer If I am not allowed to use the The other option would be to remove all initial settings. Right now, it has useful initial settings for the config, and we would loose that if the content always gets overwritten: Could you elaborate a bit about why |
I don't remember the details atm, but yes, from the design the discovery was meant to be independent of the registries to keep a clean dependency tree and not introduce any circular dependencies. Also, I would strive for a more general solution that rather works through declaration and not through code. I understand that you would love to see this solved for 5.1, but I'm afraid we ran out of time for that. |
|
@kaikreuzer I wrote this while you typed your answer above, so it is now partly outdated - I just want it to be mentioned. For me it looks like we have two options to go from here. Or we shift this logic to the bindings. Then we end up like here where we need access to the ThingRegistry. We could provide access to it via the AbstractDiscoveryService as we do for the LocaleProvider and TranslationProvider. |
Yes, I will give it a try. |
|
The dependency with thing registry also shocked me when I saw it this morning.
I like the idea. |
I tried, it was not successful. I removed all Things, also from Inbox. Started over. Added the new things, reconfigured security, waited for Thing online, restarted. No success. IMHO we should squeeze in one of the two PRs and go for a more general solution involving core after release. The general solution involving core will most likely also help for the issues @jlaur was mentioning before. |
|
Many thanks for testing so quickly @holgerfriedrich! Pity that it did not seem to work out, although I am really wondering how the matching works in that case... If you can live with #19839 until we do a first 5.1 patch release, I would suggest to go with that. It seems to be the least invasive fix we can do right now. |
|
I think will need to live with whatever we merge now for the full 5.1 life cycle. But yes, the risk might be lower with #19839. And maybe we can find a way to check/probe if security is configured. This would be even better. Something for the next patch release, maybe. There are 2 PRs out, which one to pick is your call now :-) |
I would actually love to hear a preference from any @openhab/add-ons-maintainers here. |
|
Ok, seems nobody else dares to take any decision here either. |
|
Closing in favor of #19839 - to keep the risk as low as possible and not cause any issues with the GA release tomorrow. Thanks for your understanding. 🙏 |
Unfortunately I didn't have time to jump into this yesterday, so I'm quite late to the party: Actually the mechanism that makes discovery modify existing managed Thing configuration seems to be based on the generated ThingID, not the representation property. That's one of the things that confused me while testing #19516.
Is there anything left to discuss today? I've seen a few PR's briefly, so I'm guessing this is now settled? |
|
No, all fine, thanks @jlaur. |
Prevents reconfiguration of imported Things when discovery runs. Previously, existing Things were rediscovered and reconfigured to default connection type.
Fixes #19824