2 * Copyright (c) 2010-2023 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.keypadconfig;
15 import java.util.Arrays;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.binding.lutron.internal.KeypadComponent;
20 import org.openhab.binding.lutron.internal.discovery.project.ComponentType;
23 * Keypad configuration definition for Tabletop seeTouch line
25 * @author Bob Adair - Initial contribution
28 public final class KeypadConfigTabletopSeetouch extends KeypadConfig {
30 private enum Component implements KeypadComponent {
31 BUTTON1(1, "button1", "Button 1", ComponentType.BUTTON),
32 BUTTON2(2, "button2", "Button 2", ComponentType.BUTTON),
33 BUTTON3(3, "button3", "Button 3", ComponentType.BUTTON),
34 BUTTON4(4, "button4", "Button 4", ComponentType.BUTTON),
35 BUTTON5(5, "button5", "Button 5", ComponentType.BUTTON),
36 BUTTON6(6, "button6", "Button 6", ComponentType.BUTTON),
37 BUTTON7(7, "button7", "Button 7", ComponentType.BUTTON),
38 BUTTON8(8, "button8", "Button 8", ComponentType.BUTTON),
39 BUTTON9(9, "button9", "Button 9", ComponentType.BUTTON),
40 BUTTON10(10, "button10", "Button 10", ComponentType.BUTTON),
41 BUTTON11(11, "button11", "Button 11", ComponentType.BUTTON),
42 BUTTON12(12, "button12", "Button 12", ComponentType.BUTTON),
43 BUTTON13(13, "button13", "Button 13", ComponentType.BUTTON),
44 BUTTON14(14, "button14", "Button 14", ComponentType.BUTTON),
45 BUTTON15(15, "button15", "Button 15", ComponentType.BUTTON),
47 BUTTON16(16, "button16", "Button 16", ComponentType.BUTTON),
48 BUTTON17(17, "button17", "Button 17", ComponentType.BUTTON),
50 LOWER1(20, "buttonlower1", "Lower button 1", ComponentType.BUTTON),
51 RAISE1(21, "buttonraise1", "Raise button 1", ComponentType.BUTTON),
52 LOWER2(22, "buttonlower2", "Lower button 2", ComponentType.BUTTON),
53 RAISE2(23, "buttonraise2", "Raise button 2", ComponentType.BUTTON),
54 LOWER3(24, "buttonlower3", "Lower button 3", ComponentType.BUTTON),
55 RAISE3(25, "buttonraise3", "Raise button 3", ComponentType.BUTTON),
57 LED1(81, "led1", "LED 1", ComponentType.LED),
58 LED2(82, "led2", "LED 2", ComponentType.LED),
59 LED3(83, "led3", "LED 3", ComponentType.LED),
60 LED4(84, "led4", "LED 4", ComponentType.LED),
61 LED5(85, "led5", "LED 5", ComponentType.LED),
62 LED6(86, "led6", "LED 6", ComponentType.LED),
63 LED7(87, "led7", "LED 7", ComponentType.LED),
64 LED8(88, "led8", "LED 8", ComponentType.LED),
65 LED9(89, "led9", "LED 9", ComponentType.LED),
66 LED10(90, "led10", "LED 10", ComponentType.LED),
67 LED11(91, "led11", "LED 11", ComponentType.LED),
68 LED12(92, "led12", "LED 12", ComponentType.LED),
69 LED13(93, "led13", "LED 13", ComponentType.LED),
70 LED14(94, "led14", "LED 14", ComponentType.LED),
71 LED15(95, "led15", "LED 15", ComponentType.LED),
73 LED16(96, "led16", "LED 16", ComponentType.LED),
74 LED17(97, "led17", "LED 17", ComponentType.LED);
77 private final String channel;
78 private final String description;
79 private final ComponentType type;
81 Component(int id, String channel, String description, ComponentType type) {
83 this.channel = channel;
84 this.description = description;
94 public String channel() {
99 public String description() {
104 public ComponentType type() {
109 private static final List<KeypadComponent> BUTTON_GROUP1 = Arrays.asList(Component.BUTTON1, Component.BUTTON2,
110 Component.BUTTON3, Component.BUTTON4, Component.BUTTON5);
111 private static final List<KeypadComponent> BUTTON_GROUP2 = Arrays.asList(Component.BUTTON6, Component.BUTTON7,
112 Component.BUTTON8, Component.BUTTON9, Component.BUTTON10);
113 private static final List<KeypadComponent> BUTTON_GROUP3 = Arrays.asList(Component.BUTTON11, Component.BUTTON12,
114 Component.BUTTON13, Component.BUTTON14, Component.BUTTON15);
116 private static final List<KeypadComponent> BUTTON_GROUPBOTTOM_RL = Arrays.asList(Component.BUTTON16,
117 Component.BUTTON17, Component.LOWER3, Component.RAISE3);
118 private static final List<KeypadComponent> BUTTON_GROUPBOTTOM_CRL = Arrays.asList(Component.LOWER1,
119 Component.RAISE1, Component.LOWER2, Component.RAISE2, Component.LOWER3, Component.RAISE3);
120 private static final List<KeypadComponent> BUTTON_GROUPBOTTOM_GENERIC = Arrays.asList(Component.BUTTON16,
121 Component.BUTTON17, Component.LOWER1, Component.RAISE1, Component.LOWER2, Component.RAISE2,
122 Component.LOWER3, Component.RAISE3);
124 private static final List<KeypadComponent> LED_GROUP1 = Arrays.asList(Component.LED1, Component.LED2,
125 Component.LED3, Component.LED4, Component.LED5);
126 private static final List<KeypadComponent> LED_GROUP2 = Arrays.asList(Component.LED6, Component.LED7,
127 Component.LED8, Component.LED9, Component.LED10);
128 private static final List<KeypadComponent> LED_GROUP3 = Arrays.asList(Component.LED11, Component.LED12,
129 Component.LED13, Component.LED14, Component.LED15);
131 private static final List<KeypadComponent> LED_GROUPBOTTOM_RL = Arrays.asList(Component.LED16, Component.LED17);
134 public boolean isLed(int id) {
135 return (id >= 81 && id <= 97);
139 public boolean isButton(int id) {
140 return (id >= 1 && id <= 25);
144 public boolean isCCI(int id) {
148 public KeypadConfigTabletopSeetouch() {
149 modelData.put("T5RL", combinedList(BUTTON_GROUP1, BUTTON_GROUPBOTTOM_RL, LED_GROUP1, LED_GROUPBOTTOM_RL));
151 modelData.put("T10RL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUPBOTTOM_RL, LED_GROUP1, LED_GROUP2,
152 LED_GROUPBOTTOM_RL));
154 modelData.put("T15RL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUP3, BUTTON_GROUPBOTTOM_RL,
155 LED_GROUP1, LED_GROUP2, LED_GROUP3, LED_GROUPBOTTOM_RL));
157 modelData.put("T5CRL", combinedList(BUTTON_GROUP1, BUTTON_GROUPBOTTOM_CRL, LED_GROUP1));
159 modelData.put("T10CRL",
160 combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUPBOTTOM_CRL, LED_GROUP1, LED_GROUP2));
162 modelData.put("T15CRL", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUP3, BUTTON_GROUPBOTTOM_CRL,
163 LED_GROUP1, LED_GROUP2, LED_GROUP3));
165 modelData.put("Generic", combinedList(BUTTON_GROUP1, BUTTON_GROUP2, BUTTON_GROUP3, BUTTON_GROUPBOTTOM_GENERIC,
166 LED_GROUP1, LED_GROUP2, LED_GROUP3, LED_GROUPBOTTOM_RL)); // Superset of all models