public static OpenhabCommand.Builder getCommandBuilder() { return OpenhabCommand.newBuilder(); } }
public static OpenhabCommandType.OpenhabCommand.Builder newPercentCommand(final Double value) { return getCommandBuilder().setType(CommandType.PERCENT).setPercent(PercentType.Percent.newBuilder().setValue(value.intValue()).build()); }
private String getSceneIdFromOpenHABItem(OpenhabCommandType.OpenhabCommand command) { return command.getItemBindingConfig().split(":")[1]; } }
public Future executeCommand(final String itemName, final OpenhabCommandType.OpenhabCommand.Builder command) throws CouldNotPerformException { if (command == null) { throw new CouldNotPerformException("Skip sending empty command!", new NullPointerException("Argument command is null!")); } if (openHABRemote == null) { throw new CouldNotPerformException("Skip sending command, binding not ready!", new NullPointerException("Argument rsbBinding is null!")); } logger.debug("Execute command: Setting item [" + this.itemName + "] to [" + command.getType().toString() + "]"); return openHABRemote.postCommand(command.setItem(itemName).build()); }
public static OpenhabCommandType.OpenhabCommand.Builder newDecimalCommand(final Double value) { return getCommandBuilder().setType(CommandType.DECIMAL).setDecimal(value); } }
public static OpenhabCommandType.OpenhabCommand.Builder newStopMoveCommand(final StopMoveHolderType.StopMoveHolder state) { return getCommandBuilder().setType(CommandType.STOPMOVE).setStopMove(state); }
public static OpenhabCommandType.OpenhabCommand.Builder newPercentCommand(final PercentType.Percent percent) { return getCommandBuilder().setType(CommandType.PERCENT).setPercent(percent); }
public static HSBType.HSB transform(HSBColor color) throws CouldNotTransformException { try { return HSBType.HSB.newBuilder().setHue(color.getHue()).setSaturation(color.getSaturation()).setBrightness(color.getBrightness()).build(); } catch (Exception ex) { throw new CouldNotTransformException("Could not transform " + HSBColor.class.getName() + " to " + HSBType.class.getName() + "!", ex); } } }
public static OpenhabCommandType.OpenhabCommand.Builder newPercentCommand(final Double value) { return getCommandBuilder().setType(CommandType.PERCENT).setPercent(PercentType.Percent.newBuilder().setValue(value.intValue()).build()); }
private String getIdFromOpenHABItem(OpenhabCommandType.OpenhabCommand command) { return command.getItemBindingConfig().split(":")[1]; } }
public static OpenhabCommandType.OpenhabCommand.Builder newDecimalCommand(final Double value) { return getCommandBuilder().setType(CommandType.DECIMAL).setDecimal(value); } }
public static OpenhabCommandType.OpenhabCommand.Builder newStopMoveCommand(final StopMoveHolderType.StopMoveHolder state) { return getCommandBuilder().setType(CommandType.STOPMOVE).setStopMove(state); }
private String getIdFromOpenHABCommand(OpenhabCommandType.OpenhabCommand command) { return command.getItemBindingConfig().split(":")[1]; }