Examples of TellstickBindingConfig


Examples of org.openhab.binding.tellstick.TellstickBindingConfig

  protected void internalReceiveCommand(String itemName, Command command) {
    // the code being executed when a command was sent on the openHAB
    // event bus goes here. This method is only called if one of the
    // BindingProviders provide a binding for the given 'itemName'.
    logger.debug("internalReceiveCommand() is called! for " + itemName + " with " + command);
    TellstickBindingConfig config = findTellstickBindingConfig(itemName);
    if (config != null) {
      try {
        TellstickDevice dev = findDevice(config);
        controller.handleSendEvent(config, dev, command);
      } catch (Exception e) {
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

    setProperlyConfigured(true);
  }

  private TellstickBindingConfig findTellstickBindingConfig(int itemId, TellstickValueSelector valueSel) {

    TellstickBindingConfig matchingConfig = null;
    for (TellstickBindingProvider provider : this.providers) {
      TellstickBindingConfig config = provider.getTellstickBindingConfig(itemId, valueSel);
      if (config != null) {
        matchingConfig = config;
        break;
      }
    }
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

    }
    return matchingConfig;
  }

  private TellstickBindingConfig findTellstickBindingConfig(String itemName) {
    TellstickBindingConfig matchingConfig = null;
    for (TellstickBindingProvider provider : this.providers) {
      TellstickBindingConfig config = provider.getTellstickBindingConfig(itemName);
      if (config != null) {
        matchingConfig = config;
        break;
      }
    }
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

    TellstickDevice device = event.getDevice();
    controller.setLastSend(System.currentTimeMillis());
    logger.debug("Got deviceEvent for " + device + " name:" + device + " method" + event.getMethod());
    if (device != null) {
      State cmd = resolveCommand(event.getMethod(), event.getData());
      TellstickBindingConfig conf = findTellstickBindingConfig(device.getId(), null);
      if (conf != null) {
        sendToOpenHab(conf.getItemName(), cmd);
      } else {
        logger.info("Could not find config for " + device);
      }
    }
  }
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

      String thisMsg = sensorEvent.getProtocol() + sensorEvent.getModel() + sensorEvent.getSensorId()
          + sensorEvent.getData();
      String prevMessage = prevMessages.get(sensorEvent.getDataType());
      if (!thisMsg.equals(prevMessage)) {
        prevMessages.put(sensorEvent.getDataType(), thisMsg);
        TellstickBindingConfig device = findTellstickBindingConfig(sensorEvent.getSensorId(),
            getSensorBindingType(sensorEvent.getDataType()));
        logger.debug("Got sensorEvent for " + sensorEvent.getSensorId() + " name:" + device + " value:"
            + sensorEvent.getData());
        if (device != null) {
          handleSensorEvent(sensorEvent, device);
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

   */
  @Override
  public void processBindingConfiguration(String context, Item item, String bindingConfig)
      throws BindingConfigParseException {
    super.processBindingConfiguration(context, item, bindingConfig);
    TellstickBindingConfig config = new TellstickBindingConfig();
    config.setItemName(item.getName());

    String[] configParts = bindingConfig.trim().split(":");

    if (configParts.length < 1) {
      throw new BindingConfigParseException("Tellstick binding must contain two parts separated by ':'");
    }
    TellstickDevice device;
    try {
      device = findDevice(configParts[0].trim());
    } catch (SupportedMethodsException e) {
      throw new BindingConfigParseException(e.getMessage());
    }
    validateBinding(item, configParts, device);

    if (device == null) {
      config.setId(Integer.valueOf(configParts[0].trim()));
    } else {
      config.setId(device.getId());
    }

    config.setValueSelector(TellstickValueSelector.getValueSelector(configParts[1].trim()));
    if (configParts.length > 2 && configParts[2].trim().length() > 0) {
      config.setUsageSelector(TellstickValueSelector.getValueSelector(configParts[2].trim()));
    }
    if (configParts.length > 3) {
      config.setResend(Integer.parseInt(configParts[3]));
    }

    logger.debug("Context:" + context + " Item " + item + " Conf:" + config);
    addBindingConfig(item, config);
  }
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

    }
  }

  @Override
  public TellstickBindingConfig getTellstickBindingConfig(int id, TellstickValueSelector valueSel) {
    TellstickBindingConfig name = null;
    for (Entry<String, BindingConfig> entry : bindingConfigs.entrySet()) {
      TellstickBindingConfig bv = (TellstickBindingConfig) entry.getValue();
      if (bv.getId() == id) {
        if (valueSel == null || valueSel.equals(bv.getValueSelector()))
          name = bv;
      }
    }
    return name;
  }
View Full Code Here

Examples of org.openhab.binding.tellstick.TellstickBindingConfig

  @Override
  public TellstickDevice getDevice(String itemName) {
    TellstickDevice res = null;

    TellstickBindingConfig conf = getTellstickBindingConfig(itemName);
    if (conf != null) {
      for (TellstickDevice device : getAllDevices()) {
        if (device.getId() == conf.getId()) {
          res = device;
          break;
        }
      }
    } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.