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.handler;
15 import java.util.Arrays;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.lutron.internal.KeypadComponent;
20 import org.openhab.binding.lutron.internal.discovery.project.ComponentType;
21 import org.openhab.core.thing.Thing;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
26 * Handler responsible for communicating with Lutron QS IO Interfaces
28 * @author Bob Adair - Initial contribution
31 public class QSIOHandler extends BaseKeypadHandler {
33 private enum Component implements KeypadComponent {
34 CCI1(1, "cci1", "CCI 1", ComponentType.CCI),
35 CCI2(2, "cci2", "CCI 2", ComponentType.CCI),
36 CCI3(3, "cci3", "CCI 3", ComponentType.CCI),
37 CCI4(4, "cci4", "CCI 4", ComponentType.CCI),
38 CCI5(5, "cci5", "CCI 5", ComponentType.CCI);
41 private final String channel;
42 private final String description;
43 private final ComponentType type;
45 Component(int id, String channel, String description, ComponentType type) {
47 this.channel = channel;
48 this.description = description;
58 public String channel() {
63 public String description() {
64 return this.description;
68 public ComponentType type() {
73 private final Logger logger = LoggerFactory.getLogger(QSIOHandler.class);
76 protected boolean isLed(int id) {
81 protected boolean isButton(int id) {
86 protected boolean isCCI(int id) {
87 return (id >= 1 && id <= 5);
91 protected void configureComponents(@Nullable String model) {
92 logger.debug("Configuring components for VCRX");
94 cciList.addAll(Arrays.asList(Component.CCI1, Component.CCI2, Component.CCI3, Component.CCI4, Component.CCI5));
97 public QSIOHandler(Thing thing) {