]> git.basschouten.com Git - openhab-addons.git/blob
f8624761d49c412f4eb6500116b824f24810736c
[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.handler;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.lutron.internal.discovery.project.ComponentType;
18 import org.openhab.binding.lutron.internal.keypadconfig.KeypadConfigTabletopSeetouch;
19 import org.openhab.core.thing.Thing;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 /**
24  * Handler responsible for communicating with Lutron Tabletop seeTouch keypads used in RadioRA2 and Homeworks QS systems
25  * (e.g. RR-T5RL, RR-T10RL, RR-T15RL, etc.)
26  *
27  * @author Bob Adair - Initial contribution
28  */
29 @NonNullByDefault
30 public class TabletopKeypadHandler extends BaseKeypadHandler {
31
32     private final Logger logger = LoggerFactory.getLogger(TabletopKeypadHandler.class);
33
34     @Override
35     protected void configureComponents(@Nullable String model) {
36         String mod = model == null ? "Generic" : model;
37         logger.debug("Configuring components for keypad model {}", model);
38
39         switch (mod) {
40             case "T5RL":
41             case "T10RL":
42             case "T15RL":
43             case "T5CRL":
44             case "T10CRL":
45             case "T15CRL":
46                 buttonList = kp.getComponents(mod, ComponentType.BUTTON);
47                 ledList = kp.getComponents(mod, ComponentType.LED);
48                 break;
49
50             default:
51                 logger.warn("No valid keypad model defined ({}). Assuming model T15RL.", mod);
52                 // fall through
53             case "Generic":
54                 buttonList = kp.getComponents("Generic", ComponentType.BUTTON);
55                 ledList = kp.getComponents("Generic", ComponentType.LED);
56                 break;
57         }
58     }
59
60     public TabletopKeypadHandler(Thing thing) {
61         super(thing);
62         kp = new KeypadConfigTabletopSeetouch();
63     }
64 }