Just getting started with the add-ons skeleton and already running into issues that I’m hoping someone can tell me if its an issue with the IDE or my grey matter. I’ve just changed a few constants from “THING_TYPE_SAMPLE” to more specific constants, but getting errors.
For example in UI_IP8_DPBindingConstants.java:
public class UI_IP8_DPBindingConstants {
private static final String BINDING_ID = "ui_ip8_dp";
// List of all Thing Type UIDs
public static final ThingTypeUID UI_IP8_DP = new ThingTypeUID(BINDING_ID, "UI-IP8-DP");
// List of all Channel ids
public static final String BUTTONS = "buttons";
public static final String REDLEDS = "redLeds";
}
Now in UI_IP8_DPHandlerFactory.java I have
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(UI_IP8_DP);
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
}
@Override
protected @Nullable ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (UI_IP8_DP.equals(thingTypeUID)) {
return new UI_IP8_DPHandler(thing);
}
return null;
}
}
On line private static final Set SUPPORTED_THING_TYPES_UIDS = Collections.singleton(UI_IP8_DP);
Error: private static final Object UI_IP8_DP = null
This all worked when it was “THING_TYPE_SAMPLE”. I’ve saved, re-opened, refreshed, cleaned. To the best of my knowledge Eclipse should recognize my new constant names, just as it did when the skeleton script first created the Sample items.
Btw. Use your real name in the @author tag not your alias.
Thanks for the tip.
The variable name is correct and I can fix the error by including the class name, but I think something in Eclipse is broken, or my head is broken. For demonstrate, I created a skeleton binding called “skeletonTest”, import into the workspace and Eclipse throws no errors.
If I change THING_TYPE_SAMPLE to THING_TYPE_SAMPLE_TEST in skeltonTestBindingConstants.java and then in skeletonTestHandlerFactory.java, this is okay and no errors are thrown.
Now if I change THING_TYPE_SAMPLE_TESTback to THING_TYPE_SAMPLE in both files, Eclipse throws the errors I mentioned.
If I ADD import static org.openhab.binding.skeleton.internal.skeletonBindingConstants.*; then naturally its fixed, but this wasn’t in the skeleton to begin with. Hopefully this makes sense why this doesn’t make sense.