]> git.basschouten.com Git - openhab-addons.git/blob
e432238fcf27551fa46f9a0719b39db23cfe1881
[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.nanoleaf.internal;
14
15 import java.util.Arrays;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.core.thing.ThingTypeUID;
20
21 /**
22  * The {@link NanoleafBindingConstants} class defines common constants, which are
23  * used across the whole binding.
24  *
25  * @author Martin Raepple - Initial contribution
26  */
27 @NonNullByDefault
28 public class NanoleafBindingConstants {
29
30     public static final String BINDING_ID = "nanoleaf";
31
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");
35
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";
42
43     // Panel configuration settings
44     public static final String CONFIG_PANEL_ID = "id";
45     public static final String CONTROLLER_PANEL_ID = "-1";
46
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";
63
64     // List of light panel channels
65     public static final String CHANNEL_PANEL_COLOR = "color";
66     public static final String CHANNEL_PANEL_TAP = "tap";
67
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";
77
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";
82
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
87                                                                     // support touch
88
89     // mDNS discovery service type
90     // see http://forum.nanoleaf.me/docs/openapi#_gf9l5guxt8r0
91     public static final String SERVICE_TYPE = "_nanoleafapi._tcp.local.";
92
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*";
96
97     // Color channels increase/decrease brightness step size
98     public static final int BRIGHTNESS_STEP_SIZE = 5;
99
100     // Layout rendering
101     public static final int LAYOUT_LIGHT_RADIUS = 8;
102     public static final int LAYOUT_BORDER_WIDTH = 30;
103 }