Thing Handler Factory not working with 2.5 MyQ Binding

I am working on porting the chamberlain myq binding to 2.5 and I am getting a no binding found that supports creating a thing of type error.

Cannot create thing. No binding found that supports creating a thing of type 'chamberlainmyq:MyQGateway'.

I added the id to my thing xml file.

    <bridge-type id="MyQGateway">

and the ChamberlainMyQHandlerFactory has the supportsThingType method overriden:

    public static final String BINDING_ID = "chamberlainmyq";

    public static final Set<ThingTypeUID> DISCOVERABLE_DEVICE_TYPES_UIDS =  Collections.unmodifiableSet(
        Stream.of(THING_TYPE_DOOR_OPENER, THING_TYPE_LIGHT).collect(Collectors.toSet()));

    private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS =  Collections.singleton(THING_TYPE_BRIDGE);

@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
    return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)
            || DISCOVERABLE_DEVICE_TYPES_UIDS.contains(thingTypeUID);
}

    // bridge
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "MyQGateway");

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_DOOR_OPENER = new ThingTypeUID(BINDING_ID, "MyQDoorOpener");
public static final ThingTypeUID THING_TYPE_LIGHT = new ThingTypeUID(BINDING_ID, "MyQLight");

I am unsure what the issue is, I looked at https://www.openhab.org/docs/developer/bindings/#the-thinghandlerfactory and everything looks correct. This code use to work with 2.4 but now it won’t work with 2.5M4. Any help would be greatly appreciated.

Thank you,
Scott

MyQGateway.xml (1.9 KB)
ChamberlainMyQBindingConstants.txt (3.0 KB)
ChamberlainMyQHandlerFactory.txt (3.1 KB)

Is that code available somewhere? It‘s hard to say from small snippets what could be wrong. I can only guess that the handler factory is not properly registered as a service.

In general that looks fine. Can you have a look at the bundle list if something is preventing your binding from starting (bundle:list on the karaf console, the binding bundle should be active).

Then you could check what supportsThingType returns (assign to local variable and lof before you return).

I ran your code and it works. Although I had to add the binding to the bundles/pom.xml and it crashes with null pointer exceptions because I didn’t configure it. But other than that it seems to find the thing. Maybe it’s a cache issue and you had a different version of that binding earlier?

1 Like