]> git.basschouten.com Git - openhab-addons.git/blob
875ef4fcf627ae67d5e16ccf2a587c7c8729eec5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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 Palladiom keypad line
23  *
24  * @author Bob Adair - Initial contribution
25  */
26 @NonNullByDefault
27 public final class KeypadConfigPalladiom extends KeypadConfig {
28
29     private static enum Component implements KeypadComponent {
30         BUTTON1(1, "button1", "Button 1", ComponentType.BUTTON),
31         BUTTON2(2, "button2", "Button 2", ComponentType.BUTTON),
32         BUTTON3(3, "button3", "Button 3", ComponentType.BUTTON),
33         BUTTON4(4, "button4", "Button 4", ComponentType.BUTTON),
34         BUTTON5(5, "button5", "Button 5", ComponentType.BUTTON),
35         BUTTON6(6, "button6", "Button 6", ComponentType.BUTTON),
36         BUTTON7(7, "button7", "Button 7", ComponentType.BUTTON),
37         BUTTON8(8, "button8", "Button 8", ComponentType.BUTTON),
38
39         LOWER1(16, "buttonlower1", "Lower button 1", ComponentType.BUTTON),
40         RAISE1(17, "buttonraise1", "Raise button 2", ComponentType.BUTTON),
41         LOWER2(18, "buttonlower2", "Lower button 3", ComponentType.BUTTON),
42         RAISE2(19, "buttonraise2", "Raise button 4", ComponentType.BUTTON),
43
44         LED1(81, "led1", "LED 1", ComponentType.LED),
45         LED2(82, "led2", "LED 2", ComponentType.LED),
46         LED3(83, "led3", "LED 3", ComponentType.LED),
47         LED4(84, "led4", "LED 4", ComponentType.LED),
48         LED5(85, "led5", "LED 5", ComponentType.LED),
49         LED6(86, "led6", "LED 6", ComponentType.LED),
50         LED7(87, "led7", "LED 7", ComponentType.LED),
51         LED8(88, "led8", "LED 8", ComponentType.LED);
52
53         private final int id;
54         private final String channel;
55         private final String description;
56         private final ComponentType type;
57
58         Component(int id, String channel, String description, ComponentType type) {
59             this.id = id;
60             this.channel = channel;
61             this.description = description;
62             this.type = type;
63         }
64
65         @Override
66         public int id() {
67             return id;
68         }
69
70         @Override
71         public String channel() {
72             return channel;
73         }
74
75         @Override
76         public String description() {
77             return description;
78         }
79
80         @Override
81         public ComponentType type() {
82             return type;
83         }
84     }
85
86     @Override
87     public boolean isLed(int id) {
88         return (id >= 81 && id <= 88);
89     }
90
91     @Override
92     public boolean isButton(int id) {
93         return ((id >= 1 && id <= 8) || (id >= 16 && id <= 19));
94     }
95
96     @Override
97     public boolean isCCI(int id) {
98         return false;
99     }
100
101     public KeypadConfigPalladiom() {
102         modelData.put("2W", Arrays.asList(Component.BUTTON1, Component.BUTTON4, Component.LED1, Component.LED4));
103
104         modelData.put("3W", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON4, Component.LED1,
105                 Component.LED2, Component.LED4));
106
107         modelData.put("4W", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON4,
108                 Component.LED1, Component.LED2, Component.LED3, Component.LED4));
109
110         modelData.put("RW", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.LOWER1,
111                 Component.RAISE1, Component.LED1, Component.LED2, Component.LED3));
112
113         modelData.put("22W", Arrays.asList(Component.BUTTON1, Component.BUTTON4, Component.BUTTON5, Component.BUTTON8,
114                 Component.LED1, Component.LED4, Component.LED5, Component.LED8));
115
116         modelData.put("24W",
117                 Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON4,
118                         Component.BUTTON5, Component.BUTTON8, Component.LED1, Component.LED2, Component.LED3,
119                         Component.LED4, Component.LED5, Component.LED8));
120
121         modelData.put("42W",
122                 Arrays.asList(Component.BUTTON1, Component.BUTTON4, Component.BUTTON5, Component.BUTTON6,
123                         Component.BUTTON7, Component.BUTTON8, Component.LED1, Component.LED4, Component.LED5,
124                         Component.LED6, Component.LED7, Component.LED8));
125
126         modelData.put("44W",
127                 Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON4,
128                         Component.BUTTON5, Component.BUTTON6, Component.BUTTON7, Component.BUTTON8, Component.LED1,
129                         Component.LED2, Component.LED3, Component.LED4, Component.LED5, Component.LED6, Component.LED7,
130                         Component.LED8));
131
132         modelData.put("2RW",
133                 Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON5,
134                         Component.BUTTON8, Component.LOWER1, Component.RAISE1, Component.LED1, Component.LED2,
135                         Component.LED3, Component.LED5, Component.LED8));
136
137         modelData.put("4RW",
138                 Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON5,
139                         Component.BUTTON6, Component.BUTTON7, Component.BUTTON8, Component.LOWER1, Component.RAISE1,
140                         Component.LED1, Component.LED2, Component.LED3, Component.LED5, Component.LED6, Component.LED7,
141                         Component.LED8));
142
143         modelData.put("RRW",
144                 Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.BUTTON5,
145                         Component.BUTTON6, Component.BUTTON7, Component.LOWER1, Component.RAISE1, Component.LOWER2,
146                         Component.RAISE2, Component.LED1, Component.LED2, Component.LED3, Component.LED5,
147                         Component.LED6, Component.LED7));
148
149         // Superset of all models
150         modelData.put("Generic", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3,
151                 Component.BUTTON4, Component.BUTTON5, Component.BUTTON6, Component.BUTTON7, Component.BUTTON8,
152                 Component.LOWER1, Component.RAISE1, Component.LOWER2, Component.RAISE2, Component.LED1, Component.LED2,
153                 Component.LED3, Component.LED4, Component.LED5, Component.LED6, Component.LED7, Component.LED8));
154     }
155 }