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.rme.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.thing.ThingTypeUID;
19 * The {@link RMEBindingConstants} class defines common constants, which are used across
22 * @author Karel Goderis - Initial contribution
25 public class RMEBindingConstants {
27 public static final String BINDING_ID = "rme";
29 // List of all Thing Type UIDs
30 public static final ThingTypeUID THING_TYPE_MANAGER = new ThingTypeUID(BINDING_ID, "manager");
32 // List of all Channel ids
33 public enum DataField {
35 LEVEL("waterlevel", 1),
38 EXITPUMP("exitpump", 4),
39 ENTRYPUMP("entrypump", 5),
40 WATEREXCHANGE("waterexchange", 6),
41 CISTERNSUPPLYALARM("cisternsupplyalarm", 7),
42 OVERFLOWALARM("overflowalarm", 8),
43 CISTERNBLOCKEDALARM("cisternblockedalarm", 9),
44 FILTERCLEANING("filtercleaning", 10);
46 private final String id;
47 private final int number;
49 private DataField(final String id, final int number) {
55 public String toString() {
56 return String.valueOf(number);
59 public int toNumber() {
63 public static DataField get(int valueSelectorNumber) throws IllegalArgumentException {
64 for (DataField c : DataField.values()) {
65 if (c.number == valueSelectorNumber) {
70 throw new IllegalArgumentException("Not a valid value selector");
73 public static DataField get(String valueSelectorText) throws IllegalArgumentException {
74 for (DataField c : DataField.values()) {
75 if (c.id.equals(valueSelectorText)) {
80 throw new IllegalArgumentException("Not a valid value selector");
83 public String channelID() {