2 * Copyright (c) 2010-2021 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.radiora.protocol;
15 import java.util.ArrayList;
16 import java.util.List;
19 * Button Press (BP) Command.
20 * Trigger a Phantom Button Press on the RadioRA Serial Device.
22 * @author Jeff Lauterbach - Initial Contribution
25 public class ButtonPressCommand extends RadioRACommand {
27 public enum ButtonState {
33 private int buttonNumber; // 1 to 15, 16 ALL ON, 17 ALL OFF
34 private ButtonState state; // ON/OFF/TOG
35 private Integer fadeSec; // 0 to 240 (optional)
37 public ButtonPressCommand(int buttonNumber, ButtonState state) {
38 this.buttonNumber = buttonNumber;
42 public void setFadeSeconds(int seconds) {
43 this.fadeSec = seconds;
47 public String getCommand() {
52 public List<String> getArgs() {
53 List<String> args = new ArrayList<>();
54 args.add(String.valueOf(buttonNumber));
55 args.add(String.valueOf(state));
57 if (fadeSec != null) {
58 args.add(String.valueOf(fadeSec));