]> git.basschouten.com Git - openhab-addons.git/blob
dd5069db58f88ab32627d50a7db59fa7a12ff9f9
[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.tplinksmarthome.internal;
14
15 import java.util.Set;
16 import java.util.stream.Collectors;
17 import java.util.stream.Stream;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20
21 /**
22  * This class defines common constants, which are used across the whole binding.
23  *
24  * @author Christian Fischer - Initial contribution
25  * @author Hilbrand Bouwkamp - Added channel and property keys
26  */
27 @NonNullByDefault
28 public final class TPLinkSmartHomeBindingConstants {
29
30     public enum ColorScales {
31         NOT_SUPPORTED(0, 0),
32         K_2500_6500(2500, 6500),
33         K_2700_6500(2700, 6500),
34         K_2500_9000(2500, 9000);
35
36         private final int warm;
37         private final int cool;
38
39         ColorScales(final int warm, final int cool) {
40             this.warm = warm;
41             this.cool = cool;
42         }
43
44         public int getWarm() {
45             return warm;
46         }
47
48         public int getCool() {
49             return cool;
50         }
51     }
52
53     public static final String BINDING_ID = "tplinksmarthome";
54
55     // List of all switch channel ids
56     public static final String CHANNEL_SWITCH = "switch";
57
58     // List of all plug channel ids
59     public static final String CHANNEL_LED = "led";
60
61     // List of all bulb channel ids
62     public static final String CHANNEL_BRIGHTNESS = "brightness";
63     public static final String CHANNEL_COLOR = "color";
64     public static final String CHANNEL_COLOR_TEMPERATURE = "colorTemperature";
65     public static final String CHANNEL_COLOR_TEMPERATURE_ABS = "colorTemperatureAbs";
66
67     public static final Set<String> CHANNELS_BULB_SWITCH = Stream.of(CHANNEL_BRIGHTNESS, CHANNEL_COLOR,
68             CHANNEL_COLOR_TEMPERATURE, CHANNEL_COLOR_TEMPERATURE_ABS, CHANNEL_SWITCH).collect(Collectors.toSet());
69
70     // List of all energy channel ids
71     public static final String CHANNEL_ENERGY_POWER = "power";
72     public static final String CHANNEL_ENERGY_TOTAL = "energyUsage";
73     public static final String CHANNEL_ENERGY_VOLTAGE = "voltage";
74     public static final String CHANNEL_ENERGY_CURRENT = "current";
75     public static final Set<String> CHANNELS_ENERGY = Stream
76             .of(CHANNEL_ENERGY_POWER, CHANNEL_ENERGY_TOTAL, CHANNEL_ENERGY_VOLTAGE, CHANNEL_ENERGY_CURRENT)
77             .collect(Collectors.toSet());
78
79     // List of all misc channel ids
80     public static final String CHANNEL_RSSI = "rssi";
81
82     // List of all group channel ids
83     public static final String CHANNEL_SWITCH_GROUP = "group";
84     public static final String CHANNEL_OUTLET_GROUP_PREFIX = "outlet";
85
86     // List of configuration keys
87     public static final String CONFIG_IP = "ipAddress";
88     public static final String CONFIG_DEVICE_ID = "deviceId";
89     public static final String CONFIG_REFRESH = "refresh";
90     // Only for bulbs
91     public static final String CONFIG_TRANSITION_PERIOD = "transitionPeriod";
92
93     // List of property keys
94     public static final String PROPERTY_TYPE = "type";
95     public static final String PROPERTY_MODEL = "model";
96     public static final String PROPERTY_DEVICE_NAME = "device name";
97     public static final String PROPERTY_MAC = "mac";
98     public static final String PROPERTY_HARDWARE_VERSION = "hardware version";
99     public static final String PROPERTY_SOFWARE_VERSION = "sofware version";
100     public static final String PROPERTY_HARDWARE_ID = "hardware id";
101     public static final String PROPERTY_FIRMWARE_ID = "firmware id";
102     public static final String PROPERTY_OEM_ID = "oem id";
103     public static final String PROPERTY_FEATURE = "feature";
104     public static final String PROPERTY_PROTOCOL_NAME = "protocol name";
105     public static final String PROPERTY_PROTOCOL_VERSION = "protocol version";
106
107     public static final int FORCED_REFRESH_BOUNDERY_SECONDS = 60;
108     public static final int FORCED_REFRESH_BOUNDERY_SWITCHED_SECONDS = 5;
109
110     private TPLinkSmartHomeBindingConstants() {
111         // Constants class
112     }
113 }