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;
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 Pico models
25 * @author Bob Adair - Initial contribution
28 public final class KeypadConfigPico extends KeypadConfig {
30 // Button mappings for LEAP protocol
31 public static final Map<Integer, Integer> LEAPBUTTONS_2B = Map.of(2, 1, 4, 2);
32 public static final Map<Integer, Integer> LEAPBUTTONS_2BRL = Map.of(2, 1, 4, 2, 5, 3, 6, 4);
33 public static final Map<Integer, Integer> LEAPBUTTONS_3B = Map.of(2, 1, 3, 2, 4, 3);
34 public static final Map<Integer, Integer> LEAPBUTTONS_4B = Map.of(8, 1, 9, 2, 10, 3, 11, 4);
35 public static final Map<Integer, Integer> LEAPBUTTONS_3BRL = Map.of(2, 1, 3, 2, 4, 3, 5, 4, 6, 5);
37 private static enum Component implements KeypadComponent {
38 // Buttons for 2B, 2BRL, 3B, and 3BRL models
39 BUTTON1(2, "button1", "Button 1", ComponentType.BUTTON),
40 BUTTON2(3, "button2", "Button 2", ComponentType.BUTTON),
41 BUTTON3(4, "button3", "Button 3", ComponentType.BUTTON),
43 RAISE(5, "buttonraise", "Raise Button", ComponentType.BUTTON),
44 LOWER(6, "buttonlower", "Lower Button", ComponentType.BUTTON),
46 // Buttons for PJ2-4B model
47 BUTTON1_4B(8, "button01", "Button 1", ComponentType.BUTTON),
48 BUTTON2_4B(9, "button02", "Button 2", ComponentType.BUTTON),
49 BUTTON3_4B(10, "button03", "Button 3", ComponentType.BUTTON),
50 BUTTON4_4B(11, "button04", "Button 4", ComponentType.BUTTON);
53 private final String channel;
54 private final String description;
55 private final ComponentType type;
57 Component(int id, String channel, String description, ComponentType type) {
59 this.channel = channel;
60 this.description = description;
70 public String channel() {
75 public String description() {
80 public ComponentType type() {
86 public boolean isLed(int id) {
91 public boolean isButton(int id) {
92 return (id >= 2 && id <= 11);
96 public boolean isCCI(int id) {
100 public KeypadConfigPico() {
101 modelData.put("2B", Arrays.asList(Component.BUTTON1, Component.BUTTON3));
102 modelData.put("2BRL", Arrays.asList(Component.BUTTON1, Component.BUTTON3, Component.RAISE, Component.LOWER));
103 modelData.put("3B", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3));
104 modelData.put("3BRL", Arrays.asList(Component.BUTTON1, Component.BUTTON2, Component.BUTTON3, Component.RAISE,
107 Arrays.asList(Component.BUTTON1_4B, Component.BUTTON2_4B, Component.BUTTON3_4B, Component.BUTTON4_4B));