2 * Copyright (c) 2010-2022 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";
62 // List of light panel channels
63 public static final String CHANNEL_PANEL_COLOR = "color";
64 public static final String CHANNEL_PANEL_TAP = "tap";
66 // Nanoleaf OpenAPI URLs
67 public static final String API_V1_BASE_URL = "/api/v1";
68 public static final String API_GET_CONTROLLER_INFO = "/";
69 public static final String API_ADD_USER = "/new";
70 public static final String API_EVENTS = "/events";
71 public static final String API_DELETE_USER = "";
72 public static final String API_SET_VALUE = "/state";
73 public static final String API_EFFECT = "/effects";
74 public static final String API_RHYTHM_MODE = "/rhythm/rhythmMode";
76 // Nanoleaf model IDs and minimum required firmware versions
77 public static final String API_MIN_FW_VER_LIGHTPANELS = "1.5.0";
78 public static final String API_MIN_FW_VER_CANVAS = "1.1.0";
79 public static final String MODEL_ID_LIGHTPANELS = "NL22";
81 public static final List<String> MODELS_WITH_TOUCHSUPPORT = Arrays.asList("NL29", "NL42");
82 public static final String DEVICE_TYPE_LIGHTPANELS = "lightPanels";
83 public static final String DEVICE_TYPE_TOUCHSUPPORT = "canvas"; // we need to keep this enum for backward
84 // compatibility even though not only canvas type
87 // mDNS discovery service type
88 // see http://forum.nanoleaf.me/docs/openapi#_gf9l5guxt8r0
89 public static final String SERVICE_TYPE = "_nanoleafapi._tcp.local.";
91 // Effect/scene name for static color
92 public static final String EFFECT_NAME_STATIC_COLOR = "*Dynamic*";
94 // Color channels increase/decrease brightness step size
95 public static final int BRIGHTNESS_STEP_SIZE = 5;