[SOLVED] Discovery Implementation - Textual added things/Items

Got it, get list of things from the bridge added to the top of the discovery method:

List<Thing> things = accountHandler.getThing().getThings();

Private Variable added:

private Boolean deviceAdded;

Then when i query the api:

for (int s = 0; s < structures.size(); s++) {
    sId = structures.get(s).getGroupId();
    sName = structures.get(s).getName();
    logger.debug("Structure Id {} with name {} Found", sId,sName);
    for (int d = 0; d < structures.get(s).getDevices().size(); d++) {
        dType = structures.get(s).getDevices().get(d).getCat().toString();
        dId = structures.get(s).getDevices().get(d).getDeviceId().toString();
        array1 = dId.split("-");
        sdId = array1[1].toString();
        deviceAdded = false;
        for (int i = 0; i < things.size(); i++) {
            String Id = things.get(i).getConfiguration().get("sdId").toString();
            if(Id.equals(sdId)) {
                deviceAdded = true;
            }
        }
        if (deviceAdded == false) {
        \\add the thing here
        }
    }
}

This was all I needed to know (how to query the already added things):

List<Thing> things = accountHandler.getThing().getThings();

Hopefully it will help anyone else diving in to the realms of development.

3 Likes