Examples of ZWaveCommandClass


Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

    }
    else if (multiInstanceCommandClass.getVersion() == 2) {
      ZWaveEndpoint endpoint = multiInstanceCommandClass.getEndpoint(endpointId);
     
      if (endpoint != null) {
        ZWaveCommandClass result = endpoint.getCommandClass(commandClass);
        if (result != null) {
          return result;
        }
      }
    }
    else if (multiInstanceCommandClass.getVersion() == 1) {
      ZWaveCommandClass result = getCommandClass(commandClass);
      if (endpointId <= result.getInstances()) {
        return result;
      }
    } else {
      logger.warn("NODE {}: Unsupported multi instance command version: {}.", nodeId, multiInstanceCommandClass.getVersion());
    }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

      logger.error(String.format("NODE %d: Unsupported command class 0x%02x", nodeId, commandClassCode));
      return false;
    }

    logger.debug(String.format("NODE %d: Incoming command class %s (0x%02x)", nodeId, commandClass.getLabel(), commandClass.getKey()));
    ZWaveCommandClass zwaveCommandClass =  node.getCommandClass(commandClass);
   
    // Apparently, this node supports a command class that we did not get (yet) during initialization.
    // Let's add it now then to support handling this message.
    if (zwaveCommandClass == null) {
      logger.debug(String.format("NODE %d: Command class %s (0x%02x) not found, trying to add it.",
          nodeId, commandClass.getLabel(), commandClass.getKey()));
     
      zwaveCommandClass = ZWaveCommandClass.getInstance(commandClass.getKey(), node, zController);
     
      if (zwaveCommandClass != null) {
        logger.debug(String.format("NODE %d: Adding command class %s (0x%02x)", nodeId, commandClass.getLabel(), commandClass.getKey()));
        node.addCommandClass(zwaveCommandClass);
      }
    }
   
    // We got an unsupported command class, return.
    if (zwaveCommandClass == null) {
      logger.error(String.format("NODE %d: Unsupported command class %s (0x%02x)", nodeId, commandClass.getLabel(), commandClassCode));
      return false;
    }
   
    logger.trace("NODE {}: Found Command Class {}, passing to handleApplicationCommandRequest", nodeId, zwaveCommandClass.getCommandClass().getLabel());
    zwaveCommandClass.handleApplicationCommandRequest(incomingMessage, 4, 0);

    checkTransactionComplete(lastSentMessage, incomingMessage);
   
    return false;
  }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

          if(data == 0xef)  {
            // TODO: Implement control command classes
            break;
          }
          logger.trace(String.format("NODE %d: Command class 0x%02X is supported.", nodeId, data));
          ZWaveCommandClass commandClass = ZWaveCommandClass.getInstance(data, node, zController);
          if (commandClass != null)
            node.addCommandClass(commandClass);
        }

        // advance node stage.
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

      logger.warn("No preferred command classes found for item class = {}", item.getClass().toString());
      return null;
    }

    for (CommandClass commandClass : preferredCommandClasses.get(item.getClass())) {
      ZWaveCommandClass result = node.resolveCommandClass(commandClass, endpointId);
     
      if (result != null && converters.containsKey(commandClass)) {
        return result;
      }
    }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

   * @param forceRefresh indicates that a polling refresh should be forced.
   */
  @SuppressWarnings("unchecked")
  public void executeRefresh(ZWaveBindingProvider provider, String itemName, boolean forceRefresh) {
    ZWaveBindingConfig bindingConfiguration = provider.getZwaveBindingConfig(itemName);
    ZWaveCommandClass commandClass;
    String commandClassName = bindingConfiguration.getArguments().get("command");
   
    // this binding is configured not to poll.
    if (!forceRefresh && bindingConfiguration.getRefreshInterval() != null && 0 == bindingConfiguration.getRefreshInterval())
      return;
   
    ZWaveNode node = this.controller.getNode(bindingConfiguration.getNodeId());
   
    // ignore nodes that are not initialized.
    if (node == null)
      return;
   
    if (commandClassName != null) {
     
      // this is a report item, handle it with the report info converter.
      if (commandClassName.equalsIgnoreCase("info")) {
        infoConverter.executeRefresh(provider.getItem(itemName), node, bindingConfiguration.getEndpoint(), bindingConfiguration.getArguments());
        return;
      }
     
      // ignore nodes that are not initialized or dead.
      if (node.getNodeStage() != NodeStage.DONE)
        return;
     
      commandClass = node.resolveCommandClass(CommandClass.getCommandClass(commandClassName), bindingConfiguration.getEndpoint());
     
      if (commandClass == null) {
         logger.warn("No command class found for item = {}, command class name = {}, ignoring execute refresh.", itemName, commandClassName);
         return;
      }
    } else {
      commandClass = resolveConverter(provider.getItem(itemName), node
        , bindingConfiguration.getEndpoint());
    }
   
     if (commandClass == null) {
       logger.warn("No converter found for item = {}, ignoring execute refresh.", itemName);
       return;
     }
    
     ZWaveCommandClassConverter<ZWaveCommandClass> converter = (ZWaveCommandClassConverter<ZWaveCommandClass>) getConverter(commandClass.getCommandClass());
    
     if (converter == null) {
       logger.warn("No converter found for item = {}, ignoring execute refresh.", itemName);
       return;
     }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

   *            the name of the item to poll.
   */
  @SuppressWarnings("unchecked")
  public Integer getRefreshInterval(ZWaveBindingProvider provider, String itemName) {
    ZWaveBindingConfig bindingConfiguration = provider.getZwaveBindingConfig(itemName);
    ZWaveCommandClass commandClass;
    String commandClassName = bindingConfiguration.getArguments().get("command");

    // this binding is configured not to poll.
    if (bindingConfiguration.getRefreshInterval() != null && 0 == bindingConfiguration.getRefreshInterval())
      return 0;

    ZWaveNode node = this.controller.getNode(bindingConfiguration.getNodeId());

    // ignore nodes that are not initialized.
    if (node == null)
      return 0;

    if (commandClassName != null) {
      // this is a report item, handle it with the report info converter.
      if (commandClassName.equalsIgnoreCase("info")) {
        return infoConverter.getRefreshInterval();
      }

      commandClass = node.resolveCommandClass(CommandClass.getCommandClass(commandClassName),
          bindingConfiguration.getEndpoint());

      if (commandClass == null) {
        logger.warn("No command class found for item = {}, command class name = {}, using 0 refresh interval.",
            itemName, commandClassName);
        return 0;
      }
    } else {
      commandClass = resolveConverter(provider.getItem(itemName), node, bindingConfiguration.getEndpoint());
    }

    if (commandClass == null) {
      logger.warn("No converter found for item = {}, using 0 refresh interval.", itemName);
      return 0;
    }

    ZWaveCommandClassConverter<ZWaveCommandClass> converter = (ZWaveCommandClassConverter<ZWaveCommandClass>) getConverter(commandClass
        .getCommandClass());

    if (converter == null) {
      logger.warn("No converter found for item = {}, using 0 refresh interval.", itemName);
      return 0;
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

    ZWaveNode node = this.controller.getNode(bindingConfiguration.getNodeId());
    if(node == null) {
      logger.error("Item {} has non existant node {}", itemName, bindingConfiguration.getNodeId());
      return;
    }
    ZWaveCommandClass commandClass;
    String commandClassName = bindingConfiguration.getArguments().get("command");
   
    if (commandClassName != null) {
      commandClass = node.resolveCommandClass(CommandClass.getCommandClass(commandClassName), bindingConfiguration.getEndpoint());
     
      if (commandClass == null) {
         logger.warn("No command class found for item = {}, command class name = {}, ignoring command.", itemName, commandClassName);
         return;
      }
    } else {
      commandClass = resolveConverter(provider.getItem(itemName), node
        , bindingConfiguration.getEndpoint());
    }
   
     if (commandClass == null) {
       logger.warn("No converter found for item = {}, ignoring command.", itemName);
       return;
     }
    
     ZWaveCommandClassConverter<ZWaveCommandClass> converter = (ZWaveCommandClassConverter<ZWaveCommandClass>) getConverter(commandClass.getCommandClass());
    
     if (converter == null) {
       logger.warn("No converter found for item = {}, ignoring command.", itemName);
       return;
     }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveCommandClass

    // If restored the node from configuration file then
    // the classes will already exist and this will be ignored

    // Add mandatory command classes as specified by it's generic device class.
    for (CommandClass commandClass : generic.getMandatoryCommandClasses()) {
      ZWaveCommandClass zwaveCommandClass = ZWaveCommandClass.getInstance(commandClass.getKey(), node, zController);
      if (zwaveCommandClass != null)
        zController.getNode(nodeId).addCommandClass(zwaveCommandClass);
    }

    // Add mandatory command classes as specified by it's specific device class.
    for (CommandClass commandClass : specific.getMandatoryCommandClasses()) {
      ZWaveCommandClass zwaveCommandClass = ZWaveCommandClass.getInstance(commandClass.getKey(), node, zController);
      if (zwaveCommandClass != null)
        node.addCommandClass(zwaveCommandClass);
    }

      // advance node stage of the current node.
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.