]> git.basschouten.com Git - openhab-addons.git/blob
94e540d7c94c992e80a77a6d0f1879496a5a5ca6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.lutron.internal.radiora.protocol;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.openhab.core.library.types.OnOffType;
19
20 /**
21  * Set Switch Level (SSL)
22  * Turn an individual Switch ON or OFF.
23  *
24  * @author Jeff Lauterbach - Initial Contribution
25  *
26  */
27 public class SetSwitchLevelCommand extends RadioRACommand {
28
29     private int zoneNumber; // 1 to 32
30     private OnOffType state; // ON/OFF
31     private Integer delaySec; // 0 to 240 (optional)
32
33     public SetSwitchLevelCommand(int zoneNumber, OnOffType state) {
34         this.zoneNumber = zoneNumber;
35         this.state = state;
36     }
37
38     public void setDelaySeconds(int seconds) {
39         this.delaySec = seconds;
40     }
41
42     @Override
43     public String getCommand() {
44         return "SSL";
45     }
46
47     @Override
48     public List<String> getArgs() {
49         List<String> args = new ArrayList<>();
50         args.add(String.valueOf(zoneNumber));
51         args.add(String.valueOf(state));
52
53         if (delaySec != null) {
54             args.add(String.valueOf(delaySec));
55         }
56
57         return args;
58     }
59 }