Ensuring a single bridge per binding

Is there a preferred way to ensure that only a single bridge is used per binding?

I’m new to binding development myself but I don’t think you can stop people from adding multiple bridge things.

You could however keep track of all the bridges inside your ThingHandlerFactory, choose a “canonical bridge” which is allowed to go online and then call a method / set some flag on all the other bridge handlers so they stay offline with a state like this:

updateStatus(
        ThingStatus.OFFLINE,
        ThingStatusDetail.CONFIGURATION_ERROR,
        "You are not allowed to create multiple bridges"
);

so that users know why they will not come online.

1 Like