]> git.basschouten.com Git - openhab-addons.git/blob
ab59f27111757a1261b41420537ee84638a41f1c
[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 /**
19  * Set Dimmer Level (SDL)
20  * Set an individual Dimmer’s light level.
21  *
22  * @author Jeff Lauterbach - Initial Contribution
23  *
24  */
25 public class SetDimmerLevelCommand extends RadioRACommand {
26
27     private int zoneNumber; // 1 to 32
28     private int dimmerLevel; // 0 to 100
29     private Integer fadeSec; // 0 to 240 (optional)
30
31     public SetDimmerLevelCommand(int zoneNumber, int dimmerLevel) {
32         this.zoneNumber = zoneNumber;
33         this.dimmerLevel = dimmerLevel;
34     }
35
36     public void setFadeSeconds(int seconds) {
37         fadeSec = seconds;
38     }
39
40     @Override
41     public String getCommand() {
42         return "SDL";
43     }
44
45     @Override
46     public List<String> getArgs() {
47         List<String> args = new ArrayList<>();
48         args.add(String.valueOf(zoneNumber));
49         args.add(String.valueOf(dimmerLevel));
50
51         if (fadeSec != null) {
52             args.add(String.valueOf(fadeSec));
53         }
54
55         return args;
56     }
57 }