]> git.basschouten.com Git - openhab-addons.git/blob
f363f1b342744887b3a20d9ce2d140efd6de38fb
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.energenie.internal;
14
15 import java.util.Collections;
16 import java.util.Set;
17 import java.util.regex.Pattern;
18 import java.util.stream.Collectors;
19 import java.util.stream.Stream;
20
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.openhab.core.thing.ThingTypeUID;
23
24 /**
25  * The {@link EnergenieBindingConstants} class defines common constants, which are
26  * used across the whole binding.
27  *
28  * @author Hans-Jörg Merk - Initial contribution
29  */
30 @NonNullByDefault
31 public class EnergenieBindingConstants {
32
33     private static final String BINDING_ID = "energenie";
34
35     public static final int TCP_PORT = 5000;
36
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;
42
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";
47
48     public static final String V21_STATE_ON = "0x41";
49     public static final String V21_STATE_OFF = "0x82";
50
51     public static final String WLAN_STATE_ON = "0x51";
52     public static final String WLAN_STATE_OFF = "0x92";
53
54     public static final byte SWITCH_ON = 0x01;
55     public static final byte SWITCH_OFF = 0x02;
56     public static final byte DONT_SWITCH = 0x04;
57
58     public static final int SOCKET_COUNT = 4; // AC power sockets, not network ones
59
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");
66
67     // List of all Channel ids
68     public static final Pattern CHANNEL_SOCKET = Pattern.compile("socket(\\d)");
69
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";
74
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()));
78 }