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