2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.lutron.internal.protocol;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.lutron.internal.handler.LeapBridgeHandler;
18 import org.openhab.binding.lutron.internal.protocol.leap.LeapCommand;
19 import org.openhab.binding.lutron.internal.protocol.lip.LutronCommandType;
20 import org.openhab.binding.lutron.internal.protocol.lip.LutronOperation;
21 import org.openhab.binding.lutron.internal.protocol.lip.TargetType;
24 * Lutron MODE command object
26 * @author Bob Adair - Initial contribution
29 public class ModeCommand extends LutronCommandNew {
30 public static final Integer ACTION_STEP = 1;
32 private final Integer action;
33 private final @Nullable Integer parameter;
35 public ModeCommand(LutronOperation operation, Integer integrationId, Integer action, @Nullable Integer parameter) {
36 super(TargetType.GREENMODE, operation, LutronCommandType.MODE, integrationId);
38 this.parameter = parameter;
42 public String lipCommand() {
43 StringBuilder builder = new StringBuilder().append(operation).append(commandType);
44 builder.append(',').append(integrationId);
45 builder.append(',').append(action);
46 if (parameter != null) {
47 builder.append(',').append(parameter);
50 return builder.toString();
54 public @Nullable LeapCommand leapCommand(LeapBridgeHandler bridgeHandler, @Nullable Integer leapZone) {
59 public String toString() {