Package org.openhab.model.item.binding

Examples of org.openhab.model.item.binding.BindingConfigParseException


   */
  @Override
  public void validateItemType(Item item, String bindingConfig)
      throws BindingConfigParseException {
    if (!(item instanceof NumberItem)) {
      throw new BindingConfigParseException(
          "item '"
              + item.getName()
              + "' is of type '"
              + item.getClass().getSimpleName()
              + "', only NumberItems are allowed - please check your *.items configuration");
View Full Code Here


  protected EcoTouchBindingConfig parseBindingConfig(Item item,
      EcoTouchTags bindingConfig) throws BindingConfigParseException {
    if (EcoTouchTags.validateBinding(bindingConfig, item.getClass())) {
      return new EcoTouchBindingConfig(bindingConfig);
    } else {
      throw new BindingConfigParseException("'" + bindingConfig
          + "' is no valid binding type");
    }
  }
View Full Code Here

  @Override
  public void validateItemType(Item item, String bindingConfig)
      throws BindingConfigParseException {
    /* only switch items or number items are valid */
    if (!(item instanceof NumberItem) && !(item instanceof SwitchItem))
      throw new BindingConfigParseException(
          "Invalid item type. Bindings can only be Number or Switch");
  }
View Full Code Here

  @Override
  public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
    if (!item instanceof SwitchItem ||
        item instanceof NumberItem ||
        item instanceof StringItem) ) {
      throw new BindingConfigParseException("item '" + item.getName()
          + "' is of type '" + item.getClass().getSimpleName()
          + "', only String, Switch and Number are allowed - please check your *.items configuration");
    }   
  }
View Full Code Here

  public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {
    super.processBindingConfiguration(context, item, bindingConfig);
   
    String[] configParts = bindingConfig.trim().split(",");
    if (configParts.length < 5) {
      throw new BindingConfigParseException("xPL binding configuration must contain : target,message type,schema at at least one body key/value pair");
    }
    XplBindingConfig config = new XplBindingConfig();
   
    config.Message = xPL_Utils.createMessage();
    config.Message.setTarget(configParts[0]);
View Full Code Here

      return;
    } else if (bindingConfigStr.startsWith("CreditMonitor")) {
      logger.debug("Credit Monitor binding found");
      cfg.setDeviceType(MaxCulDevice.CREDIT_MONITOR);
    } else if (configParts.length < 2) {
      throw new BindingConfigParseException(
          "MaxCul configuration requires a configuration of at least the format <device_type>:<serial_num> for a MAX! device.");
    } else {

      logger.debug("Found real device");
      /* handle device type */
 
View Full Code Here

    } else if (configPart.equals("PushButton")) {
      cfg.setDeviceType(MaxCulDevice.PUSH_BUTTON);
    } else if (configPart.equals("ShutterContact")) {
      cfg.setDeviceType(MaxCulDevice.SHUTTER_CONTACT);
    } else {
      throw new BindingConfigParseException(
          "Invalid device type. Use RadiatorThermostat / RadiatorThermostatPlus / WallThermostat / PushButton / ShutterContact");
    }
  }
View Full Code Here

      String configPart = configPartArray[1];
      if (configPart.equals("thermostat")) {
        if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
            && cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS
            && cfg.getDeviceType() != MaxCulDevice.WALL_THERMOSTAT)
          throw new BindingConfigParseException(
              "Invalid device feature. Can only use 'thermostat' on radiator or wall thermostats. This is a "
                  + cfg.getDeviceType());
        cfg.setFeature(MaxCulFeature.THERMOSTAT);
      } else if (configPart.equals("temperature")) {
        if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
            && cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS
            && cfg.getDeviceType() != MaxCulDevice.WALL_THERMOSTAT)
          throw new BindingConfigParseException(
              "Invalid device feature. Can only use 'temperature' on radiator or wall thermostats. This is a "
                  + cfg.getDeviceType());
        cfg.setFeature(MaxCulFeature.TEMPERATURE);
      } else if (configPart.equals("battery")) {
        cfg.setFeature(MaxCulFeature.BATTERY);
      } else if (configPart.equals("mode")) {
        if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
            && cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS
            && cfg.getDeviceType() != MaxCulDevice.WALL_THERMOSTAT)
          throw new BindingConfigParseException(
              "Invalid device feature. Can only use 'temperature' on radiator or wall thermostats. This is a "
                  + cfg.getDeviceType());
        cfg.setFeature(MaxCulFeature.MODE);
      } else if (configPart.equals("switch")) {
        if (cfg.getDeviceType() != MaxCulDevice.PUSH_BUTTON
            && cfg.getDeviceType() != MaxCulDevice.SHUTTER_CONTACT)
          throw new BindingConfigParseException(
              "Invalid device feature. Can only use 'switch' on PushButton or ShutterContact. This is a {}"
                  + cfg.getDeviceType());
        cfg.setFeature(MaxCulFeature.TEMPERATURE);
      } else if (configPart.equals("valvepos")) {
        if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
            && cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS)
          throw new BindingConfigParseException(
              "Invalid device feature. Can only use 'switch' on RadiatorThermostat or RadiatorThermostatPlus. This is a "
                  + cfg.getDeviceType());
        cfg.setFeature(MaxCulFeature.VALVE_POS);
      } else if (configPart.equals("reset")) {
        cfg.setFeature(MaxCulFeature.RESET);
View Full Code Here

        cfg.setWindowOpenTemperature(Double.parseDouble(configParts[4]));
        cfg.setWindowOpenDuration(Double.parseDouble(configParts[5]));
        cfg.setMeasurementOffset(Double.parseDouble(configParts[6]));
        cfg.setTemperatureConfigSet(true);
      } else
        throw new BindingConfigParseException(
            "Temperature configuration should be of form 'configTemp=<comfortTemp>/<ecoTemp>/<maxTemp>/<minTemp>/<windowOpenTemperature>/<windowOpenDuration>/<measurementOffset>'");
    } else
      throw new BindingConfigParseException(
          "Temperature configuration should be of form 'configTemp=<comfortTemp>/<ecoTemp>/<maxTemp>/<minTemp>/<windowOpenTemperature>/<windowOpenDuration>/<measurementOffset>'");
  }
View Full Code Here

      cfg.clearAssociatedSerialNum();
      for (int idx = 0; idx < associations.length; idx++) {
        cfg.addAssociatedSerialNum(associations[idx]);
      }
    } else
      throw new BindingConfigParseException(
          "Format of association configuration is incorrect! must be 'association=<serialNum>[,<serialNum>,[...]]'");
  }
View Full Code Here

TOP

Related Classes of org.openhab.model.item.binding.BindingConfigParseException

Copyright © 2018 www.massapicom. 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.