/**
   * Receives a command from openHAB and translates it to an operation on the Z-Wave network.
   *
   * @param provider the {@link ZWaveBindingProvider} that provides the item
   * @param itemName the name of the item that will receive the event.
   * @param command the received {@link Command}
   */
  @SuppressWarnings("unchecked")
  public void receiveCommand(ZWaveBindingProvider provider, String itemName, Command command) {
    ZWaveBindingConfig bindingConfiguration = provider.getZwaveBindingConfig(itemName);
    ZWaveNode node = this.controller.getNode(bindingConfiguration.getNodeId());
    ZWaveCommandClass commandClass;
    String commandClassName = bindingConfiguration.getArguments().get("command");

    // ignore nodes that are not initialized or dead.
    if (node.getNodeStage() != NodeStage.DONE) return;

    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;
    }

    converter.receiveCommand(
        provider.getItem(itemName),
        command,
        node,
        commandClass,
        bindingConfiguration.getEndpoint(),
        bindingConfiguration.getArguments());
  }