Package org.openhab.binding.plugwise

Examples of org.openhab.binding.plugwise.PlugwiseBindingProvider


  @Override
  protected void internalReceiveCommand(String itemName,
      Command command) {

    PlugwiseBindingProvider provider = findFirstMatchingBindingProvider(itemName);
    String commandAsString = command.toString();

    if(command != null){

      List<Command> commands = new ArrayList<Command>();

      // check if the command is valid for this item by checking if a pw ID exists
      String checkID = provider.getPlugwiseID(itemName,command);

      if(checkID != null) {
        commands.add(command);
      } else {
        // ooops - command is not defined, but maybe we have something of the same Type (e.g Decimal, String types)
        //commands = provider.getCommandsByType(itemName, command.getClass());
        commands = provider.getAllCommands(itemName);
      }

      for(Command someCommand : commands) {

        String plugwiseID = provider.getPlugwiseID(itemName,someCommand);
        PlugwiseCommandType plugwiseCommandType = provider.getPlugwiseCommandType(itemName,someCommand);

        if(plugwiseID != null) {
          if(plugwiseCommandType != null){
            @SuppressWarnings("unused")
            boolean result = executeCommand(plugwiseID,plugwiseCommandType,commandAsString);
View Full Code Here


   *
   * @return the matching binding provider or <code>null</code> if no binding
   *         provider could be found
   */
  protected PlugwiseBindingProvider findFirstMatchingBindingProvider(String itemName) {
    PlugwiseBindingProvider firstMatchingProvider = null;
    for (PlugwiseBindingProvider provider : providers) {
      List<String> plugwiseIDs = provider.getPlugwiseID(itemName);
      if (plugwiseIDs != null && plugwiseIDs.size() > 0) {
        firstMatchingProvider = provider;
        break;
View Full Code Here

TOP

Related Classes of org.openhab.binding.plugwise.PlugwiseBindingProvider

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.