]> git.basschouten.com Git - openhab-addons.git/blob
4e25e6555ac556d05fa793a9389d757aee4b1e39
[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.lifx.internal;
14
15 import java.util.Set;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.lifx.internal.fields.HSBK;
19 import org.openhab.core.library.types.HSBType;
20 import org.openhab.core.library.types.PercentType;
21 import org.openhab.core.thing.ThingTypeUID;
22 import org.openhab.core.thing.type.ChannelTypeUID;
23
24 /**
25  * The {@link LifxBindingConstants} class defines common constants, which are used across
26  * the whole binding.
27  *
28  * @author Dennis Nobel - Initial contribution
29  * @author Wouter Born - Added packet interval, power on brightness constants
30  */
31 @NonNullByDefault
32 public class LifxBindingConstants {
33
34     public static final String BINDING_ID = "lifx";
35
36     // The LIFX LAN Protocol Specification states that lights can process up to 20 messages per second, not more.
37     public static final long PACKET_INTERVAL = 50;
38
39     // Port constants
40     public static final int BROADCAST_PORT = 56700;
41     public static final int UNICAST_PORT = 56700;
42
43     // Minimum and maximum of MultiZone light indices
44     public static final int MIN_ZONE_INDEX = 0;
45     public static final int MAX_ZONE_INDEX = 255;
46
47     // Fallback light state defaults
48     public static final HSBK DEFAULT_COLOR = new HSBK(HSBType.WHITE, 3000);
49     public static final PercentType DEFAULT_BRIGHTNESS = PercentType.HUNDRED;
50
51     // List of all Channel IDs
52     public static final String CHANNEL_ABS_TEMPERATURE = "abstemperature";
53     public static final String CHANNEL_ABS_TEMPERATURE_ZONE = "abstemperaturezone";
54     public static final String CHANNEL_BRIGHTNESS = "brightness";
55     public static final String CHANNEL_COLOR = "color";
56     public static final String CHANNEL_COLOR_ZONE = "colorzone";
57     public static final String CHANNEL_EFFECT = "effect";
58     public static final String CHANNEL_HEV_CYCLE = "hevcycle";
59     public static final String CHANNEL_INFRARED = "infrared";
60     public static final String CHANNEL_SIGNAL_STRENGTH = "signalstrength";
61     public static final String CHANNEL_TEMPERATURE = "temperature";
62     public static final String CHANNEL_TEMPERATURE_ZONE = "temperaturezone";
63
64     // List of all Channel Type UIDs
65     public static final ChannelTypeUID CHANNEL_TYPE_BRIGHTNESS = new ChannelTypeUID(BINDING_ID, CHANNEL_BRIGHTNESS);
66     public static final ChannelTypeUID CHANNEL_TYPE_COLOR = new ChannelTypeUID(BINDING_ID, CHANNEL_COLOR);
67     public static final ChannelTypeUID CHANNEL_TYPE_EFFECT = new ChannelTypeUID(BINDING_ID, CHANNEL_EFFECT);
68     public static final ChannelTypeUID CHANNEL_TYPE_HEV_CYCLE = new ChannelTypeUID(BINDING_ID, CHANNEL_HEV_CYCLE);
69     public static final ChannelTypeUID CHANNEL_TYPE_INFRARED = new ChannelTypeUID(BINDING_ID, CHANNEL_INFRARED);
70     public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE = new ChannelTypeUID(BINDING_ID, CHANNEL_TEMPERATURE);
71
72     // List of options for effect channel
73     public static final String CHANNEL_TYPE_EFFECT_OPTION_OFF = "off";
74     public static final String CHANNEL_TYPE_EFFECT_OPTION_MORPH = "morph";
75     public static final String CHANNEL_TYPE_EFFECT_OPTION_FLAME = "flame";
76
77     // Config property for the LIFX device id
78     public static final String CONFIG_PROPERTY_DEVICE_ID = "deviceId";
79     public static final String CONFIG_PROPERTY_FADETIME = "fadetime";
80
81     // Config property for channel configuration
82     public static final String CONFIG_PROPERTY_HEV_CYCLE_DURATION = "hevCycleDuration";
83     public static final String CONFIG_PROPERTY_EFFECT_FLAME_SPEED = "effectFlameSpeed";
84     public static final String CONFIG_PROPERTY_EFFECT_MORPH_SPEED = "effectMorphSpeed";
85     public static final String CONFIG_PROPERTY_POWER_ON_BRIGHTNESS = "powerOnBrightness";
86     public static final String CONFIG_PROPERTY_POWER_ON_COLOR = "powerOnColor";
87     public static final String CONFIG_PROPERTY_POWER_ON_TEMPERATURE = "powerOnTemperature";
88
89     // Property keys
90     public static final String PROPERTY_HOST = "host";
91     public static final String PROPERTY_HOST_VERSION = "hostVersion";
92     public static final String PROPERTY_MAC_ADDRESS = "macAddress";
93     public static final String PROPERTY_PRODUCT_ID = "productId";
94     public static final String PROPERTY_PRODUCT_NAME = "productName";
95     public static final String PROPERTY_PRODUCT_VERSION = "productVersion";
96     public static final String PROPERTY_VENDOR_ID = "vendorId";
97     public static final String PROPERTY_VENDOR_NAME = "vendorName";
98     public static final String PROPERTY_WIFI_VERSION = "wifiVersion";
99     public static final String PROPERTY_ZONES = "zones";
100
101     // List of all Thing Type UIDs
102     public static final ThingTypeUID THING_TYPE_COLORLIGHT = new ThingTypeUID(BINDING_ID, "colorlight");
103     public static final ThingTypeUID THING_TYPE_COLORHEVLIGHT = new ThingTypeUID(BINDING_ID, "colorhevlight");
104     public static final ThingTypeUID THING_TYPE_COLORIRLIGHT = new ThingTypeUID(BINDING_ID, "colorirlight");
105     public static final ThingTypeUID THING_TYPE_COLORMZLIGHT = new ThingTypeUID(BINDING_ID, "colormzlight");
106     public static final ThingTypeUID THING_TYPE_TILELIGHT = new ThingTypeUID(BINDING_ID, "tilelight");
107     public static final ThingTypeUID THING_TYPE_WHITELIGHT = new ThingTypeUID(BINDING_ID, "whitelight");
108
109     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Set.of(THING_TYPE_COLORLIGHT,
110             THING_TYPE_COLORHEVLIGHT, THING_TYPE_COLORIRLIGHT, THING_TYPE_COLORMZLIGHT, THING_TYPE_TILELIGHT,
111             THING_TYPE_WHITELIGHT);
112 }