]> git.basschouten.com Git - openhab-addons.git/blob
1dbed5f85c6912b8753441912fed303a0b087ca4
[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 import java.util.List;
17
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;
21
22 /**
23  * Keypad configuration definition for Tabletop seeTouch line
24  *
25  * @author Bob Adair - Initial contribution
26  */
27 @NonNullByDefault
28 public final class KeypadConfigGrafikEye extends KeypadConfig {
29
30     private static enum Component implements KeypadComponent {
31         BUTTON1(70, "button1", "Button 1", ComponentType.BUTTON), // Scene button 1
32         BUTTON2(71, "button2", "Button 2", ComponentType.BUTTON), // Scene button 2
33         BUTTON3(76, "button3", "Button 3", ComponentType.BUTTON), // Scene button 3
34         BUTTON4(77, "button4", "Button 4", ComponentType.BUTTON), // Scene button 4
35         BUTTON5(83, "button5", "Button 5", ComponentType.BUTTON), // Scene button 5/Off
36
37         BUTTON10(38, "button10", "Button 10", ComponentType.BUTTON), // Col 1
38         BUTTON11(39, "button11", "Button 11", ComponentType.BUTTON), // Col 1
39         BUTTON12(40, "button12", "Button 12", ComponentType.BUTTON), // Col 1
40         LOWER1(41, "buttonlower1", "Lower button col 1", ComponentType.BUTTON), // Col 1 lower
41         RAISE1(47, "buttonraise1", "Raise button col 1", ComponentType.BUTTON), // Col 1 raise
42
43         BUTTON20(44, "button20", "Button 20", ComponentType.BUTTON), // Col 2
44         BUTTON21(45, "button21", "Button 21", ComponentType.BUTTON), // Col 2
45         BUTTON22(46, "button22", "Button 22", ComponentType.BUTTON), // Col 2
46         LOWER2(52, "buttonlower2", "Lower button col 2", ComponentType.BUTTON), // Col 2 lower
47         RAISE2(53, "buttonraise2", "Raise button col 2", ComponentType.BUTTON), // Col 2 raise
48
49         BUTTON30(50, "button30", "Button 30", ComponentType.BUTTON), // Col 3
50         BUTTON31(51, "button31", "Button 31", ComponentType.BUTTON), // Col 3
51         BUTTON32(56, "button32", "Button 32", ComponentType.BUTTON), // Col 3
52         LOWER3(57, "buttonlower3", "Lower button col 3", ComponentType.BUTTON), // Col 3 lower
53         RAISE3(58, "buttonraise3", "Raise button col 3", ComponentType.BUTTON), // Col 3 raise
54
55         CCI1(163, "cci1", "CCI 1", ComponentType.CCI),
56
57         LED1(201, "led1", "LED 1", ComponentType.LED), // Scene button LEDs
58         LED2(210, "led2", "LED 2", ComponentType.LED),
59         LED3(219, "led3", "LED 3", ComponentType.LED),
60         LED4(228, "led4", "LED 4", ComponentType.LED),
61         LED5(237, "led5", "LED 5", ComponentType.LED),
62
63         LED10(174, "led10", "LED 10", ComponentType.LED), // Col 1 LEDs
64         LED11(175, "led11", "LED 11", ComponentType.LED),
65         LED12(211, "led12", "LED 12", ComponentType.LED),
66
67         LED20(183, "led20", "LED 20", ComponentType.LED), // Col 2 LEDs
68         LED21(184, "led21", "LED 21", ComponentType.LED),
69         LED22(220, "led22", "LED 22", ComponentType.LED),
70
71         LED30(192, "led30", "LED 30", ComponentType.LED), // Col 3 LEDs
72         LED31(193, "led31", "LED 31", ComponentType.LED),
73         LED32(229, "led32", "LED 32", ComponentType.LED);
74
75         private final int id;
76         private final String channel;
77         private final String description;
78         private final ComponentType type;
79
80         Component(int id, String channel, String description, ComponentType type) {
81             this.id = id;
82             this.channel = channel;
83             this.description = description;
84             this.type = type;
85         }
86
87         @Override
88         public int id() {
89             return id;
90         }
91
92         @Override
93         public String channel() {
94             return channel;
95         }
96
97         @Override
98         public String description() {
99             return description;
100         }
101
102         @Override
103         public ComponentType type() {
104             return type;
105         }
106     }
107
108     private static final List<KeypadComponent> SCENE_BUTTON_GROUP = Arrays.asList(Component.BUTTON1, Component.BUTTON2,
109             Component.BUTTON3, Component.BUTTON4, Component.BUTTON5);
110     private static final List<KeypadComponent> SCENE_LED_GROUP = Arrays.asList(Component.LED1, Component.LED2,
111             Component.LED3, Component.LED4, Component.LED5);
112
113     private static final List<KeypadComponent> CCI_GROUP = Arrays.asList(Component.CCI1);
114
115     private static final List<KeypadComponent> COL1_BUTTON_GROUP = Arrays.asList(Component.BUTTON10, Component.BUTTON11,
116             Component.BUTTON12, Component.LOWER1, Component.RAISE1);
117     private static final List<KeypadComponent> COL2_BUTTON_GROUP = Arrays.asList(Component.BUTTON20, Component.BUTTON21,
118             Component.BUTTON22, Component.LOWER2, Component.RAISE2);
119     private static final List<KeypadComponent> COL3_BUTTON_GROUP = Arrays.asList(Component.BUTTON30, Component.BUTTON31,
120             Component.BUTTON32, Component.LOWER3, Component.RAISE3);
121
122     private static final List<KeypadComponent> COL1_LED_GROUP = Arrays.asList(Component.LED10, Component.LED11,
123             Component.LED12);
124     private static final List<KeypadComponent> COL2_LED_GROUP = Arrays.asList(Component.LED20, Component.LED21,
125             Component.LED22);
126     private static final List<KeypadComponent> COL3_LED_GROUP = Arrays.asList(Component.LED30, Component.LED31,
127             Component.LED32);
128
129     @Override
130     public boolean isLed(int id) {
131         return (id >= 174 && id <= 237);
132     }
133
134     @Override
135     public boolean isButton(int id) {
136         return (id >= 38 && id <= 83);
137     }
138
139     @Override
140     public boolean isCCI(int id) {
141         return (id == 163);
142     }
143
144     public KeypadConfigGrafikEye() {
145         modelData.put("0COL", combinedList(SCENE_BUTTON_GROUP, CCI_GROUP, SCENE_LED_GROUP));
146
147         modelData.put("1COL",
148                 combinedList(SCENE_BUTTON_GROUP, COL1_BUTTON_GROUP, CCI_GROUP, SCENE_LED_GROUP, COL1_LED_GROUP));
149
150         modelData.put("2COL", combinedList(SCENE_BUTTON_GROUP, COL1_BUTTON_GROUP, COL2_BUTTON_GROUP, CCI_GROUP,
151                 SCENE_LED_GROUP, COL1_LED_GROUP, COL2_LED_GROUP));
152
153         modelData.put("3COL", combinedList(SCENE_BUTTON_GROUP, COL1_BUTTON_GROUP, COL2_BUTTON_GROUP, COL3_BUTTON_GROUP,
154                 CCI_GROUP, SCENE_LED_GROUP, COL1_LED_GROUP, COL2_LED_GROUP, COL3_LED_GROUP));
155     }
156 }