]> git.basschouten.com Git - openhab-addons.git/blob
abb5548d5a6267d7f44d81e06a3ce53f62f3716f
[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.keypadconfig;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.lutron.internal.KeypadComponent;
19 import org.openhab.binding.lutron.internal.discovery.project.ComponentType;
20
21 /**
22  * Keypad configuration definition for Pico models
23  *
24  * @author Bob Adair - Initial contribution
25  */
26 @NonNullByDefault
27 public final class KeypadConfigPico extends KeypadConfig {
28
29     private static enum Component implements KeypadComponent {
30         // Buttons for 2B, 2BRL, 3B, and 3BRL models
31         BUTTON1(2, "button1", "Button 1", ComponentType.BUTTON),
32         BUTTON2(3, "button2", "Button 2", ComponentType.BUTTON),
33         BUTTON3(4, "button3", "Button 3", ComponentType.BUTTON),
34
35         RAISE(5, "buttonraise", "Raise Button", ComponentType.BUTTON),
36         LOWER(6, "buttonlower", "Lower Button", ComponentType.BUTTON),
37
38         // Buttons for PJ2-4B model
39         BUTTON1_4B(8, "button01", "Button 1", ComponentType.BUTTON),
40         BUTTON2_4B(9, "button02", "Button 2", ComponentType.BUTTON),
41         BUTTON3_4B(10, "button03", "Button 3", ComponentType.BUTTON),
42         BUTTON4_4B(11, "button04", "Button 4", ComponentType.BUTTON);
43
44         private final int id;
45         private final String channel;
46         private final String description;
47         private final ComponentType type;
48
49         Component(int id, String channel, String description, ComponentType type) {
50             this.id = id;
51             this.channel = channel;
52             this.description = description;
53             this.type = type;
54         }
55
56         @Override
57         public int id() {
58             return id;
59         }
60
61         @Override
62         public String channel() {
63             return channel;
64         }
65
66         @Override
67         public String description() {
68             return description;
69         }
70
71         @Override
72         public ComponentType type() {
73             return type;
74         }
75     }
76
77     @Override
78     public boolean isLed(int id) {
79         return false;
80     }
81
82     @Override
83     public boolean isButton(int id) {
84         return (id >= 2 && id <= 11);
85     }
86
87     @Override
88     public boolean isCCI(int id) {
89         return false;
90     }
91
92     public KeypadConfigPico() {
93         modelData.put("2B", Arrays.asList(Component.BUTTON1, Component.BUTTON3));
94         modelData.put("2BRL", Arrays.asList(Component.BUTTON1, Component.BUTTON3, Component.RAISE, Component.LOWER));
95         modelData.put("3B", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3));
96         modelData.put("3BRL", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.RAISE,
97                 Component.LOWER));
98         modelData.put("4B",
99                 Arrays.asList(Component.BUTTON1_4B, Component.BUTTON2_4B, Component.BUTTON3_4B, Component.BUTTON4_4B));
100     }
101 }