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_SYSTEM = "enabledsystem";
45 public static final String CHANNEL_ENABLED_USER = "enableduser";
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) {
95 public boolean matchesSeries(char c) {
96 return things.contains(c);
99 public static KebaSeries getSeries(char text) throws IllegalArgumentException {
100 for (KebaSeries c : KebaSeries.values()) {
101 if (c.matchesSeries(text)) {
106 throw new IllegalArgumentException("Not a valid series: '" + text + "'");