Package org.openhab.core.types

Examples of org.openhab.core.types.Command


          // into real commands by the webapp.
          if ((item instanceof SwitchItem || item instanceof GroupItem) && commandName.equals("TOGGLE")) {
            commandName = OnOffType.ON.equals(item.getStateAs(OnOffType.class)) ? "OFF" : "ON";
          }
         
          Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandName);
          if(command!=null) {
            eventPublisher.sendCommand(itemName, command);
          } else {
            logger.warn("Received unknown command '{}' for item '{}'", commandName, itemName);           
          }
View Full Code Here


          String itemName = args[0];
          try {
            Item item = registry.getItemByPattern(itemName);
            if(args.length>1) {
              String commandName = args[1];
              Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandName);
              if(command!=null) {
                publisher.sendCommand(itemName, command);
                console.println("Command has been sent successfully.");
              } else {
                console.println("Error: Command '" + commandName +
View Full Code Here

    if(operation.equals(EventType.UPDATE.toString())) {
      State newState = (State) event.getProperty("state");
      if(newState!=null) receiveUpdate(itemName, newState);
    }
    if(operation.equals(EventType.COMMAND.toString())) {
      Command command = (Command) event.getProperty("command");
      if(command!=null) receiveCommand(itemName, command);
    }
  }
View Full Code Here

  @Context UriInfo localUriInfo;
    @POST @Path("/{itemname: [a-zA-Z_0-9]*}")
  @Consumes(MediaType.TEXT_PLAIN
  public Response postItemCommand(@PathParam("itemname") String itemname, String value) {
      Item item = getItem(itemname);
      Command command = null;
      if(item!=null) {
        // support for TOGGLE, see https://code.google.com/p/openhab/issues/detail?id=336
        if("toggle".equalsIgnoreCase(value) &&
            (item instanceof SwitchItem ||
             item instanceof RollershutterItem)) {
View Full Code Here

        if(PlugwiseCommandType.validateBinding(type, item)) {

          PlugwiseBindingConfigElement newElement = new PlugwiseBindingConfigElement(plugwiseID,type,interval);

          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

    }

    @Override
    public void valueChanged(ParameterAddress parameterAddress, Value valueObject) {
        ButtonState buttonState = (ButtonState) valueObject;
        Command command = null;
        if (Parameter.O.name().equals(parameterAddress.getParameterId())) {
            switch (buttonState) {
            case PRESSED:
                if (belongsToLastShortButtonPress()) {
                    command = StopMoveType.STOP;
View Full Code Here

   
   

    @Override
    public void valueChanged(ParameterAddress parameterAddress, Value valueObject) {
        Command command = null;
       
        if (valueObject.getValue().equals(Positions.DOWN.toString()))
          command = new StringType("CLOSED");
        else if (valueObject.getValue().equals(Positions.MIDDLE.toString()))
          command = new StringType("OPEN");
View Full Code Here

    }

    @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

        super(item, eventPublisher);
    }

    @Override
    public void valueChanged(ParameterAddress parameterAddress, Value valueObject) {
        Command command = null;
        if (buttonIPressed(parameterAddress)) {
            command = OnOffType.ON;
        } else if (buttonOPressed(parameterAddress)) {
            command = OnOffType.OFF;
        }
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.