ThingHandlerService & Background Discovery

When I setup my DiscoveryService as described here, startBackgroundDiscovery() method is called before the Bridge initialization has been completed. Is this expected behavior? Of course, as I have a bridge-based discovery of things, I need to have the bridge initialized first before I start discovery. Otherwise, background discovery obviously can’t work.

In case somebody wants to check, this is my code where I believe to observe this behavior: openhab-addons/FlicSimpleclientDiscoveryServiceImpl.java at flicbutton-thinghandlerservice · pfink/openhab-addons · GitHub (I get a NPE which should not happen if the bridge would be already initialized).

See my comment on GitHub

Thanks! Just FTR, @hilbrand’s answer is here: [flicbutton] Initial contribution FlicButton Binding by pfink · Pull Request #9234 · openhab/openhab-addons · GitHub