2 * Copyright (c) 2010-2021 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.lifx.internal;
16 import java.util.stream.Collectors;
17 import java.util.stream.Stream;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.lifx.internal.fields.HSBK;
21 import org.openhab.core.library.types.HSBType;
22 import org.openhab.core.library.types.PercentType;
23 import org.openhab.core.thing.ThingTypeUID;
24 import org.openhab.core.thing.type.ChannelTypeUID;
27 * The {@link LifxBinding} class defines common constants, which are used across
30 * @author Dennis Nobel - Initial contribution
31 * @author Wouter Born - Added packet interval, power on brightness constants
34 public class LifxBindingConstants {
36 public static final String BINDING_ID = "lifx";
38 // The LIFX LAN Protocol Specification states that lights can process up to 20 messages per second, not more.
39 public static final long PACKET_INTERVAL = 50;
42 public static final int BROADCAST_PORT = 56700;
43 public static final int UNICAST_PORT = 56700;
45 // Minimum and maximum of MultiZone light indices
46 public static final int MIN_ZONE_INDEX = 0;
47 public static final int MAX_ZONE_INDEX = 255;
49 // Fallback light state defaults
50 public static final HSBK DEFAULT_COLOR = new HSBK(HSBType.WHITE, 3000);
51 public static final PercentType DEFAULT_BRIGHTNESS = PercentType.HUNDRED;
53 // List of all Channel IDs
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_INFRARED = "infrared";
59 public static final String CHANNEL_SIGNAL_STRENGTH = "signalstrength";
60 public static final String CHANNEL_TEMPERATURE = "temperature";
61 public static final String CHANNEL_TEMPERATURE_ZONE = "temperaturezone";
63 // List of all Channel Type UIDs
64 public static final ChannelTypeUID CHANNEL_TYPE_BRIGHTNESS = new ChannelTypeUID(BINDING_ID, CHANNEL_BRIGHTNESS);
65 public static final ChannelTypeUID CHANNEL_TYPE_COLOR = new ChannelTypeUID(BINDING_ID, CHANNEL_COLOR);
66 public static final ChannelTypeUID CHANNEL_TYPE_COLOR_ZONE = new ChannelTypeUID(BINDING_ID, CHANNEL_COLOR_ZONE);
67 public static final ChannelTypeUID CHANNEL_TYPE_EFFECT = new ChannelTypeUID(BINDING_ID, CHANNEL_EFFECT);
68 public static final ChannelTypeUID CHANNEL_TYPE_INFRARED = new ChannelTypeUID(BINDING_ID, CHANNEL_INFRARED);
69 public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE = new ChannelTypeUID(BINDING_ID, CHANNEL_TEMPERATURE);
70 public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE_ZONE = new ChannelTypeUID(BINDING_ID,
71 CHANNEL_TEMPERATURE_ZONE);
73 // List of options for effect channel
74 public static final String CHANNEL_TYPE_EFFECT_OPTION_OFF = "off";
75 public static final String CHANNEL_TYPE_EFFECT_OPTION_MORPH = "morph";
76 public static final String CHANNEL_TYPE_EFFECT_OPTION_FLAME = "flame";
78 // Config property for the LIFX device id
79 public static final String CONFIG_PROPERTY_DEVICE_ID = "deviceId";
80 public static final String CONFIG_PROPERTY_FADETIME = "fadetime";
82 // Config property for channel configuration
83 public static final String CONFIG_PROPERTY_POWER_ON_BRIGHTNESS = "powerOnBrightness";
84 public static final String CONFIG_PROPERTY_POWER_ON_COLOR = "powerOnColor";
85 public static final String CONFIG_PROPERTY_POWER_ON_TEMPERATURE = "powerOnTemperature";
86 public static final String CONFIG_PROPERTY_EFFECT_MORPH_SPEED = "effectMorphSpeed";
87 public static final String CONFIG_PROPERTY_EFFECT_FLAME_SPEED = "effectFlameSpeed";
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";
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_COLORIRLIGHT = new ThingTypeUID(BINDING_ID, "colorirlight");
104 public static final ThingTypeUID THING_TYPE_COLORMZLIGHT = new ThingTypeUID(BINDING_ID, "colormzlight");
105 public static final ThingTypeUID THING_TYPE_WHITELIGHT = new ThingTypeUID(BINDING_ID, "whitelight");
106 public static final ThingTypeUID THING_TYPE_TILELIGHT = new ThingTypeUID(BINDING_ID, "tilelight");
108 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Stream.of(THING_TYPE_COLORLIGHT,
109 THING_TYPE_COLORIRLIGHT, THING_TYPE_COLORMZLIGHT, THING_TYPE_WHITELIGHT, THING_TYPE_TILELIGHT)
110 .collect(Collectors.toSet());