code: public ZWaveCommandClass resolveCommandClass(ZWaveCommandClass.CommandClass commandClass, int endpointId)
  	{
  		if (commandClass == null)
  			return null;
  		
  		ZWaveMultiInstanceCommandClass multiInstanceCommandClass = (ZWaveMultiInstanceCommandClass)supportedCommandClasses.get(ZWaveCommandClass.CommandClass.MULTI_INSTANCE);
  		
  		if (multiInstanceCommandClass != null && multiInstanceCommandClass.getVersion() == 2) {
  			ZWaveEndpoint endpoint = multiInstanceCommandClass.getEndpoint(endpointId);
  			
  			if (endpoint != null) { 
  				ZWaveCommandClass result = endpoint.getCommandClass(commandClass);
  				if (result != null)
  					return result;
  			} 
  		}
  		
  		ZWaveCommandClass result = getCommandClass(commandClass);
  		
  		if (result == null)
  			return result;
  		
  		if (multiInstanceCommandClass != null && multiInstanceCommandClass.getVersion() == 1 &&
  				result.getInstances() >= endpointId)
  			return result;
  		
  		return endpointId == 1 ? result : null;
  	}
docs: Resolves a command class for this node. First endpoint is checked.
  If endpoint == 1 or (endpoint != 1 and version of the multi instance
  command == 1) then return a supported command class on the node itself.
  If endpoint != 1 and version of the multi instance command == 2 then
  first try command classes of endpoints. If not found the return a
  supported command class on the node itself.
  Returns null if a command class is not found.
  @param commandClass The command class to resolve.
  @param endpointId the endpoint / instance to resolve this command class for.
  @return the command class.