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