]> git.basschouten.com Git - openhab-addons.git/blob
6469b2c05faa5a58763b78b5c0dd49ced0cce5b6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.nuki.internal;
14
15 import java.util.Collections;
16 import java.util.Set;
17 import java.util.stream.Collectors;
18 import java.util.stream.Stream;
19
20 import org.openhab.core.thing.ThingTypeUID;
21
22 /**
23  * The {@link NukiBinding} class defines common constants, which are
24  * used across the whole binding.
25  *
26  * @author Markus Katter - Initial contribution
27  * @contributer Christian Hoefler - Door sensor integration
28  */
29 public class NukiBindingConstants {
30
31     public static final String BINDING_ID = "nuki";
32
33     // List of all Thing Type UIDs
34     public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
35     public static final ThingTypeUID THING_TYPE_SMARTLOCK = new ThingTypeUID(BINDING_ID, "smartlock");
36
37     public static final Set<ThingTypeUID> THING_TYPE_BRIDGE_UIDS = Collections.singleton(THING_TYPE_BRIDGE);
38     public static final Set<ThingTypeUID> THING_TYPE_SMARTLOCK_UIDS = Collections.singleton(THING_TYPE_SMARTLOCK);
39
40     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Stream
41             .concat(THING_TYPE_BRIDGE_UIDS.stream(), THING_TYPE_SMARTLOCK_UIDS.stream()).collect(Collectors.toSet());
42
43     // List of all Channel ids
44     public static final String CHANNEL_SMARTLOCK_LOCK = "lock";
45     public static final String CHANNEL_SMARTLOCK_STATE = "lockState";
46     public static final String CHANNEL_SMARTLOCK_LOW_BATTERY = "lowBattery";
47     public static final String CHANNEL_SMARTLOCK_DOOR_STATE = "doorsensorState";
48
49     // List of all config-description parameters
50     public static final String CONFIG_IP = "ip";
51     public static final String CONFIG_PORT = "port";
52     public static final String CONFIG_MANAGECB = "manageCallbacks";
53     public static final String CONFIG_API_TOKEN = "apiToken";
54     public static final String CONFIG_NUKI_ID = "nukiId";
55     public static final String CONFIG_UNLATCH = "unlatch";
56
57     // Nuki Bridge API REST Endpoints
58     public static final String URI_INFO = "http://%s:%s/info?token=%s";
59     public static final String URI_LOCKSTATE = "http://%s:%s/lockState?token=%s&nukiId=%s";
60     public static final String URI_LOCKACTION = "http://%s:%s/lockAction?token=%s&nukiId=%s&action=%s";
61     public static final String URI_CBADD = "http://%s:%s/callback/add?token=%s&url=%s";
62     public static final String URI_CBLIST = "http://%s:%s/callback/list?token=%s";
63     public static final String URI_CBREMOVE = "http://%s:%s/callback/remove?token=%s&id=%s";
64
65     // openHAB Callback Endpoint & Nuki Bridge Callback URL
66     public static final String CALLBACK_ENDPOINT = "/nuki/bcb";
67     public static final String CALLBACK_URL = "http://%s" + CALLBACK_ENDPOINT;
68
69     // Nuki Bridge API Lock Actions
70     public static final int LOCK_ACTIONS_UNLOCK = 1;
71     public static final int LOCK_ACTIONS_LOCK = 2;
72     public static final int LOCK_ACTIONS_UNLATCH = 3;
73     public static final int LOCK_ACTIONS_LOCKNGO_UNLOCK = 4;
74     public static final int LOCK_ACTIONS_LOCKNGO_UNLATCH = 5;
75
76     // Nuki Bridge API Lock States
77     public static final int LOCK_STATES_UNCALIBRATED = 0;
78     public static final int LOCK_STATES_LOCKED = 1;
79     public static final int LOCK_STATES_UNLOCKING = 2;
80     public static final int LOCK_STATES_UNLOCKED = 3;
81     public static final int LOCK_STATES_LOCKING = 4;
82     public static final int LOCK_STATES_UNLATCHED = 5;
83     public static final int LOCK_STATES_UNLOCKED_LOCKNGO = 6;
84     public static final int LOCK_STATES_UNLATCHING = 7;
85     public static final int LOCK_STATES_MOTOR_BLOCKED = 254;
86     public static final int LOCK_STATES_UNDEFINED = 255;
87
88     // Nuki Binding additional Lock States
89     public static final int LOCK_STATES_UNLOCKING_LOCKNGO = 1002;
90     public static final int LOCK_STATES_UNLATCHING_LOCKNGO = 1007;
91
92     // Nuki Binding Door States
93     public static final int DOORSENSOR_STATES_UNAVAILABLE = 0;
94     public static final int DOORSENSOR_STATES_DEACTIVATED = 1;
95     public static final int DOORSENSOR_STATES_CLOSED = 2;
96     public static final int DOORSENSOR_STATES_OPEN = 3;
97     public static final int DOORSENSOR_STATES_UNKNOWN = 4;
98     public static final int DOORSENSOR_STATES_CALIBRATING = 5;
99 }