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.nanoleaf.internal;
15 import java.util.Arrays;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.core.thing.ThingTypeUID;
22 * The {@link NanoleafBindingConstants} class defines common constants, which are
23 * used across the whole binding.
25 * @author Martin Raepple - Initial contribution
28 public class NanoleafBindingConstants {
30 public static final String BINDING_ID = "nanoleaf";
32 // List of all Thing Type UIDs
33 public static final ThingTypeUID THING_TYPE_CONTROLLER = new ThingTypeUID(BINDING_ID, "controller");
34 public static final ThingTypeUID THING_TYPE_LIGHT_PANEL = new ThingTypeUID(BINDING_ID, "lightpanel");
36 // Controller configuration settings
37 public static final String CONFIG_ADDRESS = "address";
38 public static final String CONFIG_PORT = "port";
39 public static final String CONFIG_AUTH_TOKEN = "authToken";
40 public static final String CONFIG_DEVICE_TYPE_CANVAS = "canvas";
41 public static final String CONFIG_DEVICE_TYPE_LIGHTPANELS = "lightPanels";
43 // Panel configuration settings
44 public static final String CONFIG_PANEL_ID = "id";
45 public static final String CONTROLLER_PANEL_ID = "-1";
47 // List of controller channels
48 public static final String CHANNEL_COLOR = "color";
49 public static final String CHANNEL_COLOR_TEMPERATURE = "colorTemperature";
50 public static final String CHANNEL_COLOR_TEMPERATURE_ABS = "colorTemperatureAbs";
51 public static final String CHANNEL_COLOR_MODE = "colorMode";
52 public static final String CHANNEL_EFFECT = "effect";
53 public static final String CHANNEL_RHYTHM_STATE = "rhythmState";
54 public static final String CHANNEL_RHYTHM_ACTIVE = "rhythmActive";
55 public static final String CHANNEL_RHYTHM_MODE = "rhythmMode";
56 public static final String CHANNEL_SWIPE = "swipe";
57 public static final String CHANNEL_SWIPE_EVENT_UP = "UP";
58 public static final String CHANNEL_SWIPE_EVENT_DOWN = "DOWN";
59 public static final String CHANNEL_SWIPE_EVENT_LEFT = "LEFT";
60 public static final String CHANNEL_SWIPE_EVENT_RIGHT = "RIGHT";
61 public static final String CHANNEL_LAYOUT = "layout";
62 public static final String CHANNEL_VISUAL_STATE = "visualState";
64 // List of light panel channels
65 public static final String CHANNEL_PANEL_COLOR = "color";
66 public static final String CHANNEL_PANEL_TAP = "tap";
68 // Nanoleaf OpenAPI URLs
69 public static final String API_V1_BASE_URL = "/api/v1";
70 public static final String API_GET_CONTROLLER_INFO = "/";
71 public static final String API_ADD_USER = "/new";
72 public static final String API_EVENTS = "/events";
73 public static final String API_DELETE_USER = "";
74 public static final String API_SET_VALUE = "/state";
75 public static final String API_EFFECT = "/effects";
76 public static final String API_RHYTHM_MODE = "/rhythm/rhythmMode";
78 // Nanoleaf model IDs and minimum required firmware versions
79 public static final String API_MIN_FW_VER_LIGHTPANELS = "1.5.0";
80 public static final String API_MIN_FW_VER_CANVAS = "1.1.0";
81 public static final String MODEL_ID_LIGHTPANELS = "NL22";
83 public static final List<String> MODELS_WITH_TOUCHSUPPORT = Arrays.asList("NL29", "NL42", "NL47", "NL48", "NL52");
84 public static final String DEVICE_TYPE_LIGHTPANELS = "lightPanels";
85 public static final String DEVICE_TYPE_TOUCHSUPPORT = "canvas"; // we need to keep this enum for backward
86 // compatibility even though not only canvas type
89 // mDNS discovery service type
90 // see http://forum.nanoleaf.me/docs/openapi#_gf9l5guxt8r0
91 public static final String SERVICE_TYPE = "_nanoleafapi._tcp.local.";
93 // Effect/scene name for static color
94 public static final String EFFECT_NAME_STATIC_COLOR = "*Static*";
95 public static final String EFFECT_NAME_SOLID_COLOR = "*Solid*";
97 // Color channels increase/decrease brightness step size
98 public static final int BRIGHTNESS_STEP_SIZE = 5;
101 public static final int LAYOUT_LIGHT_RADIUS = 8;
102 public static final int LAYOUT_BORDER_WIDTH = 30;