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.energenie.internal;
15 import java.util.Collections;
17 import java.util.regex.Pattern;
18 import java.util.stream.Collectors;
19 import java.util.stream.Stream;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.openhab.core.thing.ThingTypeUID;
25 * The {@link EnergenieBindingConstants} class defines common constants, which are
26 * used across the whole binding.
28 * @author Hans-Jörg Merk - Initial contribution
31 public class EnergenieBindingConstants {
33 private static final String BINDING_ID = "energenie";
35 public static final int TCP_PORT = 5000;
37 public static final int STATCRYP_LEN = 4;
38 public static final int CTRLCRYP_LEN = 4;
39 public static final int KEY_LEN = 8;
40 public static final int TASK_LEN = 4;
41 public static final int SOLUTION_LEN = 4;
43 public static final String STATE_ON = "0x11";
44 public static final String STATE_ON_NO_VOLTAGE = "0x12";
45 public static final String STATE_OFF = "0x22";
46 public static final String STATE_OFF_NO_VOLTAGE = "0x21";
48 public static final String V21_STATE_ON = "0x41";
49 public static final String V21_STATE_OFF = "0x82";
51 public static final String WLAN_STATE_ON = "0x51";
52 public static final String WLAN_STATE_OFF = "0x92";
54 public static final byte SWITCH_ON = 0x01;
55 public static final byte SWITCH_OFF = 0x02;
56 public static final byte DONT_SWITCH = 0x04;
58 public static final int SOCKET_COUNT = 4; // AC power sockets, not network ones
60 // List of all Thing Type UIDs
61 public static final ThingTypeUID THING_TYPE_PM2LAN = new ThingTypeUID(BINDING_ID, "pm2lan");
62 public static final ThingTypeUID THING_TYPE_PMSLAN = new ThingTypeUID(BINDING_ID, "pmslan");
63 public static final ThingTypeUID THING_TYPE_PMS2LAN = new ThingTypeUID(BINDING_ID, "pms2lan");
64 public static final ThingTypeUID THING_TYPE_PMSWLAN = new ThingTypeUID(BINDING_ID, "pmswlan");
65 public static final ThingTypeUID THING_TYPE_PWMLAN = new ThingTypeUID(BINDING_ID, "pwmlan");
67 // List of all Channel ids
68 public static final Pattern CHANNEL_SOCKET = Pattern.compile("socket(\\d)");
70 public static final String VOLTAGE = "voltage";
71 public static final String CURRENT = "current";
72 public static final String POWER = "power";
73 public static final String ENERGY = "energy";
75 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet(
76 Stream.of(THING_TYPE_PM2LAN, THING_TYPE_PMSLAN, THING_TYPE_PMS2LAN, THING_TYPE_PMSLAN, THING_TYPE_PWMLAN)
77 .collect(Collectors.toSet()));