]> git.basschouten.com Git - openhab-addons.git/blob
32e0e8f7096a90737102231b545d4a5b9b34ce26
[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.KeypadConfigPalladiom;
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 Palladiom keypads used in
25  * Homeworks QS systems
26  *
27  * @author Bob Adair - Initial contribution
28  */
29 @NonNullByDefault
30 public class PalladiomKeypadHandler extends BaseKeypadHandler {
31
32     private final Logger logger = LoggerFactory.getLogger(PalladiomKeypadHandler.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 "2W":
41             case "3W":
42             case "4W":
43             case "RW":
44             case "22W":
45             case "24W":
46             case "42W":
47             case "44W":
48             case "2RW":
49             case "4RW":
50             case "RRW":
51                 buttonList = kp.getComponents(mod, ComponentType.BUTTON);
52                 ledList = kp.getComponents(mod, ComponentType.LED);
53                 cciList = kp.getComponents(mod, ComponentType.CCI);
54                 break;
55             default:
56                 logger.warn("No valid keypad model defined ({}). Assuming Generic setting.", mod);
57                 // fall through
58             case "Generic":
59                 buttonList = kp.getComponents("Generic", ComponentType.BUTTON);
60                 ledList = kp.getComponents("Generic", ComponentType.LED);
61                 cciList = kp.getComponents("Generic", ComponentType.CCI);
62                 break;
63         }
64     }
65
66     public PalladiomKeypadHandler(Thing thing) {
67         super(thing);
68         kp = new KeypadConfigPalladiom();
69     }
70 }