Package org.openhab.core.types

Examples of org.openhab.core.types.Command


    }

    @Override
    public void valueChanged(ParameterAddress parameterAddress, Value valueObject) {
        ButtonState buttonState = (ButtonState) valueObject;
        Command command = null;
        if (buttonDownPressed(parameterAddress)) {
            switch (buttonState) {
            case PRESSED:
                startDimmerThread(IncreaseDecreaseType.INCREASE);
                buttonOPressedTime = System.currentTimeMillis();
View Full Code Here


          directionType = Direction.IN;
        }

        ProtocolBindingConfigElement newElement = new ProtocolBindingConfigElement(host,port,directionType,protocolCommand,item.getAcceptedDataTypes());

        Command command = null;
        if(commandAsString == null) {
          // for those configuration strings that are not really linked to a openHAB command we
          // create a dummy Command to be able to store the configuration information
          // I have choosen to do that with NumberItems
          NumberItem dummy = new NumberItem(Integer.toString(counter));
View Full Code Here

   *
   * @see {@link TypeParser}
   */
  private Command createCommandFromString(Item item, String commandAsString) throws BindingConfigParseException {

    Command command = TypeParser.parseCommand(
        item.getAcceptedCommandTypes(), commandAsString);

    if (command == null) {
      throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' ");
    }
View Full Code Here

    ItemRegistry registry = (ItemRegistry) RulesActivator.itemRegistryTracker.getService();
    EventPublisher publisher = (EventPublisher) RulesActivator.eventPublisherTracker.getService();
    if(publisher!=null && registry!=null) {
      try {
        Item item = registry.getItem(itemName);
        Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandString);
        publisher.sendCommand(itemName, command);
      } catch (ItemNotFoundException e) {
        logger.warn("Item '" + itemName + "' does not exist.");
      }
    }
View Full Code Here

      commandSubscriber = new MqttMessageSubscriber(brokerName + ":"
          + topic + ":command:default") {

        @Override
        public void processMessage(String topic, byte[] message) {
          Command command;
          try {
            command = getCommand(new String(message));
          } catch (Exception e) {
            logger.error("Error parsing command from message.", e);
            return;
View Full Code Here

      }

      value = StringUtils.replace(value, "${itemName}", getItemName());

      if (getMessageType().equals(MessageType.COMMAND)) {
        Command command = getCommand(value);
        eventPublisher.postCommand(getItemName(), command);
      } else {
        State state = getState(value);
        eventPublisher.postUpdate(getItemName(), state);
      }
View Full Code Here

    String responseType = MediaTypeHelper.getResponseMediaType(headers.getAcceptableMediaTypes());
    if(responseType!=null) {
      Item item = ReadResource.getItem(itemName);
      boolean commandSend = false;
      if (item!=null) {
        Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), value);
        if (command!=null) {
          CVApplication.getEventPublisher().postCommand(item.getName(),command);
          commandSend = true;
        }
      }
View Full Code Here

      return; // we have received an event with an invalid topic
    }
    String operation = topicParts[1];
   
    if(operation.equals(EventType.COMMAND.toString())) {
      Command command = (Command) event.getProperty("command");
      if(command!=null) receiveCommand(itemName, command);
    }
  }
View Full Code Here

    ItemRegistry registry = (ItemRegistry) ScriptActivator.itemRegistryTracker.getService();
    EventPublisher publisher = (EventPublisher) ScriptActivator.eventPublisherTracker.getService();
    if(publisher!=null && registry!=null) {
      try {
        Item item = registry.getItem(itemName);
        Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandString);
        publisher.sendCommand(itemName, command);
      } catch (ItemNotFoundException e) {
        logger.warn("Item '" + itemName + "' does not exist.");
      }
    }
View Full Code Here

    matcher.reset();
       
    ExecBindingConfigElement configElement;
   
    while (matcher.find()) {
      Command command = createCommandFromString(item, matcher.group(1));
     
      configElement = new ExecBindingConfigElement();
      configElement.commandLine = matcher.group(2).replaceAll("\\\\\"", "");
     
      config.put(command, configElement);
View Full Code Here

TOP

Related Classes of org.openhab.core.types.Command

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.