@Override
  protected ThingHandler createHandler(Thing thing) {

    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(YahooWeatherBindingConstants.THING_TYPE_WEATHER)) {
      return new YahooWeatherHandler(thing);
    }

    return null;
  }
Exemplo n.º 2
0
  @Override
  protected ThingHandler createHandler(Thing thing) {

    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(THING_TYPE_SAMPLE)) {
      return new nest2Handler(thing);
    }

    return null;
  }
  @Override
  protected ThingHandler createHandler(Thing thing) {

    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(THING_TYPE_COMPUTER)) {
      return new SysteminfoHandler(thing);
    }

    return null;
  }
  @Override
  protected ThingHandler createHandler(Thing thing) {

    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(URTSI_DEVICE_THING_TYPE) && thing instanceof Bridge) {
      return new UrtsiDeviceHandler((Bridge) thing);
    } else if (thingTypeUID.equals(RTS_DEVICE_THING_TYPE)) {
      return new RtsDeviceHandler(thing);
    }

    return null;
  }
  private ThingUID findThingUID(String thingType, String thingId) throws IllegalArgumentException {
    for (ThingTypeUID supportedThingTypeUID : getSupportedThingTypes()) {
      String uid = supportedThingTypeUID.getId();

      if (uid.equalsIgnoreCase(thingType)) {

        return new ThingUID(
            supportedThingTypeUID,
            netatmoBridgeHandler.getThing().getUID(),
            thingId.replaceAll("[^a-zA-Z0-9_]", ""));
      }
    }

    throw new IllegalArgumentException("Unsupported device type discovered :" + thingType);
  }
  @Override
  protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(SQUEEZEBOXPLAYER_THING_TYPE)) {
      return new SqueezeBoxPlayerHandler(thing);
    }

    if (thingTypeUID.equals(SQUEEZEBOXSERVER_THING_TYPE)) {
      logger.trace("Returning handler for bridge thing {}", thing);
      SqueezeBoxServerHandler handler = new SqueezeBoxServerHandler((Bridge) thing);
      registerSqueezeBoxPlayerDiscoveryService(handler);
      return handler;
    }

    return null;
  }
  @Override
  protected ThingHandler createHandler(Thing thing) {

    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(THING_TYPE_IPBRIDGE)) {
      return new IPBridgeHandler((Bridge) thing);
    } else if (thingTypeUID.equals(THING_TYPE_DIMMER)) {
      return new DimmerHandler(thing);
    } else if (thingTypeUID.equals(THING_TYPE_SWITCH)) {
      return new SwitchHandler(thing);
    } else if (thingTypeUID.equals(THING_TYPE_OCCUPANCYSENSOR)) {
      return new OccupancySensorHandler(thing);
    } else if (thingTypeUID.equals(THING_TYPE_KEYPAD)) {
      return new KeypadHandler(thing);
    }

    return null;
  }