2 * Copyright (c) 2010-2020 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.tplinksmarthome.internal;
16 import java.util.stream.Collectors;
17 import java.util.stream.Stream;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
22 * This class defines common constants, which are used across the whole binding.
24 * @author Christian Fischer - Initial contribution
25 * @author Hilbrand Bouwkamp - Added channel and property keys
28 public final class TPLinkSmartHomeBindingConstants {
30 public static final String BINDING_ID = "tplinksmarthome";
32 // List of all switch channel ids
33 public static final String CHANNEL_SWITCH = "switch";
35 // List of all plug channel ids
36 public static final String CHANNEL_LED = "led";
38 // List of all bulb channel ids
39 public static final String CHANNEL_BRIGHTNESS = "brightness";
40 public static final String CHANNEL_COLOR = "color";
41 public static final String CHANNEL_COLOR_TEMPERATURE = "colorTemperature";
42 public static final String CHANNEL_COLOR_TEMPERATURE_ABS = "colorTemperatureAbs";
43 public static final int COLOR_TEMPERATURE_1_MIN = 2700;
44 public static final int COLOR_TEMPERATURE_1_MAX = 6500;
45 public static final int COLOR_TEMPERATURE_2_MIN = 2500;
46 public static final int COLOR_TEMPERATURE_2_MAX = 9000;
48 public static final Set<String> CHANNELS_BULB_SWITCH = Stream.of(CHANNEL_BRIGHTNESS, CHANNEL_COLOR,
49 CHANNEL_COLOR_TEMPERATURE, CHANNEL_COLOR_TEMPERATURE_ABS, CHANNEL_SWITCH).collect(Collectors.toSet());
51 // List of all energy channel ids
52 public static final String CHANNEL_ENERGY_POWER = "power";
53 public static final String CHANNEL_ENERGY_TOTAL = "energyUsage";
54 public static final String CHANNEL_ENERGY_VOLTAGE = "voltage";
55 public static final String CHANNEL_ENERGY_CURRENT = "current";
56 public static final Set<String> CHANNELS_ENERGY = Stream
57 .of(CHANNEL_ENERGY_POWER, CHANNEL_ENERGY_TOTAL, CHANNEL_ENERGY_VOLTAGE, CHANNEL_ENERGY_CURRENT)
58 .collect(Collectors.toSet());
60 // List of all misc channel ids
61 public static final String CHANNEL_RSSI = "rssi";
63 // List of all group channel ids
64 public static final String CHANNEL_SWITCH_GROUP = "group";
65 public static final String CHANNEL_OUTLET_GROUP_PREFIX = "outlet";
67 // List of configuration keys
68 public static final String CONFIG_IP = "ipAddress";
69 public static final String CONFIG_DEVICE_ID = "deviceId";
70 public static final String CONFIG_REFRESH = "refresh";
72 public static final String CONFIG_TRANSITION_PERIOD = "transitionPeriod";
74 // List of property keys
75 public static final String PROPERTY_TYPE = "type";
76 public static final String PROPERTY_MODEL = "model";
77 public static final String PROPERTY_DEVICE_NAME = "device name";
78 public static final String PROPERTY_MAC = "mac";
79 public static final String PROPERTY_HARDWARE_VERSION = "hardware version";
80 public static final String PROPERTY_SOFWARE_VERSION = "sofware version";
81 public static final String PROPERTY_HARDWARE_ID = "hardware id";
82 public static final String PROPERTY_FIRMWARE_ID = "firmware id";
83 public static final String PROPERTY_OEM_ID = "oem id";
84 public static final String PROPERTY_FEATURE = "feature";
85 public static final String PROPERTY_PROTOCOL_NAME = "protocol name";
86 public static final String PROPERTY_PROTOCOL_VERSION = "protocol version";
88 public static final int FORCED_REFRESH_BOUNDERY_SECONDS = 60;
89 public static final int FORCED_REFRESH_BOUNDERY_SWITCHED_SECONDS = 5;
91 private TPLinkSmartHomeBindingConstants() {