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.keba.internal;
15 import java.util.ArrayList;
16 import java.util.List;
18 import org.apache.commons.lang3.ArrayUtils;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.core.thing.ThingTypeUID;
23 * The {@link KebaBinding} class defines common constants, which are used across
26 * @author Karel Goderis - Initial contribution
29 public class KebaBindingConstants {
31 public static final String BINDING_ID = "keba";
33 // List of all Thing Type UIDs
34 public static final ThingTypeUID THING_TYPE_KECONTACTP20 = new ThingTypeUID(BINDING_ID, "kecontact");
36 // List of all Channel ids
37 public static final String CHANNEL_MODEL = "model";
38 public static final String CHANNEL_FIRMWARE = "firmware";
39 public static final String CHANNEL_STATE = "state";
40 public static final String CHANNEL_ERROR_1 = "error1";
41 public static final String CHANNEL_ERROR_2 = "error2";
42 public static final String CHANNEL_WALLBOX = "wallbox";
43 public static final String CHANNEL_VEHICLE = "vehicle";
44 public static final String CHANNEL_PLUG_LOCKED = "locked";
45 public static final String CHANNEL_ENABLED = "enabled";
46 public static final String CHANNEL_PILOT_CURRENT = "maxpilotcurrent";
47 public static final String CHANNEL_PILOT_PWM = "maxpilotcurrentdutycyle";
48 public static final String CHANNEL_MAX_SYSTEM_CURRENT = "maxsystemcurrent";
49 public static final String CHANNEL_MAX_PRESET_CURRENT_RANGE = "maxpresetcurrentrange";
50 public static final String CHANNEL_MAX_PRESET_CURRENT = "maxpresetcurrent";
51 public static final String CHANNEL_FAILSAFE_CURRENT = "failsafecurrent";
52 public static final String CHANNEL_INPUT = "input";
53 public static final String CHANNEL_OUTPUT = "output";
54 public static final String CHANNEL_SERIAL = "serial";
55 public static final String CHANNEL_UPTIME = "uptime";
56 public static final String CHANNEL_I1 = "I1";
57 public static final String CHANNEL_I2 = "I2";
58 public static final String CHANNEL_I3 = "I3";
59 public static final String CHANNEL_U1 = "U1";
60 public static final String CHANNEL_U2 = "U2";
61 public static final String CHANNEL_U3 = "U3";
62 public static final String CHANNEL_POWER = "power";
63 public static final String CHANNEL_POWER_FACTOR = "powerfactor";
64 public static final String CHANNEL_SESSION_CONSUMPTION = "sessionconsumption";
65 public static final String CHANNEL_TOTAL_CONSUMPTION = "totalconsumption";
66 public static final String CHANNEL_DISPLAY = "display";
67 public static final String CHANNEL_AUTHON = "authon";
68 public static final String CHANNEL_AUTHREQ = "authreq";
69 public static final String CHANNEL_SESSION_RFID_TAG = "sessionrfidtag";
70 public static final String CHANNEL_SESSION_RFID_CLASS = "sessionrfidclass";
71 public static final String CHANNEL_SESSION_SESSION_ID = "sessionid";
72 public static final String CHANNEL_SETENERGY = "setenergylimit";
73 public static final String CHANNEL_AUTHENTICATE = "authenticate";
75 public enum KebaType {
80 public enum KebaSeries {
85 X('A', 'B', 'C', 'D', 'E', 'G', 'H');
87 private final List<Character> things = new ArrayList<>();
89 KebaSeries(char... e) {
90 Character[] cArray = ArrayUtils.toObject(e);
91 for (char c : cArray) {
96 public boolean matchesSeries(char c) {
97 return things.contains(c);
100 public static KebaSeries getSeries(char text) throws IllegalArgumentException {
101 for (KebaSeries c : KebaSeries.values()) {
102 if (c.matchesSeries(text)) {
107 throw new IllegalArgumentException("Not a valid series: '" + text + "'");