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.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 enum ColorScales {
32 K_2500_6500(2500, 6500),
33 K_2700_6500(2700, 6500),
34 K_2500_9000(2500, 9000);
36 private final int warm;
37 private final int cool;
39 ColorScales(final int warm, final int cool) {
44 public int getWarm() {
48 public int getCool() {
53 public static final String BINDING_ID = "tplinksmarthome";
55 // List of all switch channel ids
56 public static final String CHANNEL_SWITCH = "switch";
58 // List of all plug channel ids
59 public static final String CHANNEL_LED = "led";
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";
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());
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());
79 // List of all misc channel ids
80 public static final String CHANNEL_RSSI = "rssi";
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";
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";
91 public static final String CONFIG_TRANSITION_PERIOD = "transitionPeriod";
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";
107 public static final int FORCED_REFRESH_BOUNDERY_SECONDS = 60;
108 public static final int FORCED_REFRESH_BOUNDERY_SWITCHED_SECONDS = 5;
110 private TPLinkSmartHomeBindingConstants() {