]> git.basschouten.com Git - openhab-addons.git/blob
b1e2ae72e8f72938ef834af52d6c9f69e936cabc
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.constants;
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.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.core.thing.ThingTypeUID;
22
23 /**
24  * The {@link NukiBinding} class defines common constants, which are
25  * used across the whole binding.
26  *
27  * @author Markus Katter - Initial contribution
28  * @contributer Christian Hoefler - Door sensor integration
29  * @contributer Jan Vybíral - Opener integration
30  */
31 @NonNullByDefault
32 public class NukiBindingConstants {
33
34     public static final String BINDING_ID = "nuki";
35
36     // List of all Thing Type UIDs
37     public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
38     public static final ThingTypeUID THING_TYPE_SMARTLOCK = new ThingTypeUID(BINDING_ID, "smartlock");
39     public static final ThingTypeUID THING_TYPE_OPENER = new ThingTypeUID(BINDING_ID, "opener");
40
41     public static final Set<ThingTypeUID> THING_TYPE_BRIDGE_UIDS = Collections.singleton(THING_TYPE_BRIDGE);
42     public static final Set<ThingTypeUID> THING_TYPE_SMARTLOCK_UIDS = Collections.singleton(THING_TYPE_SMARTLOCK);
43     public static final Set<ThingTypeUID> THING_TYPE_OPENER_UIDS = Collections.singleton(THING_TYPE_OPENER);
44
45     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Stream
46             .of(THING_TYPE_BRIDGE_UIDS, THING_TYPE_SMARTLOCK_UIDS, THING_TYPE_OPENER_UIDS).flatMap(Set::stream)
47             .collect(Collectors.toSet());
48
49     // Device Types
50     public static final int DEVICE_SMART_LOCK = 0;
51     public static final int DEVICE_OPENER = 2;
52     public static final Set<Integer> SUPPORTED_DEVICES = Set.of(DEVICE_OPENER, DEVICE_SMART_LOCK);
53
54     // Properties
55     public static final String PROPERTY_WIFI_FIRMWARE_VERSION = "wifiFirmwareVersion";
56     public static final String PROPERTY_HARDWARE_ID = "hardwareId";
57     public static final String PROPERTY_SERVER_ID = "serverId";
58     public static final String PROPERTY_FIRMWARE_VERSION = "firmwareVersion";
59     public static final String PROPERTY_NAME = "name";
60     public static final String PROPERTY_NUKI_ID = "nukiId";
61     public static final String PROPERTY_BRIDGE_ID = "bridgeId";
62
63     // List of all Smart Lock Channel ids
64     public static final String CHANNEL_SMARTLOCK_LOCK = "lock";
65     public static final String CHANNEL_SMARTLOCK_STATE = "lockState";
66     public static final String CHANNEL_SMARTLOCK_LOW_BATTERY = "lowBattery";
67     public static final String CHANNEL_SMARTLOCK_KEYPAD_LOW_BATTERY = "keypadLowBattery";
68     public static final String CHANNEL_SMARTLOCK_BATTERY_LEVEL = "batteryLevel";
69     public static final String CHANNEL_SMARTLOCK_BATTERY_CHARGING = "batteryCharging";
70     public static final String CHANNEL_SMARTLOCK_DOOR_STATE = "doorsensorState";
71
72     // List of all Opener Channel ids
73     public static final String CHANNEL_OPENER_STATE = "openerState";
74     public static final String CHANNEL_OPENER_MODE = "openerMode";
75     public static final String CHANNEL_OPENER_LOW_BATTERY = "openerLowBattery";
76     public static final String CHANNEL_OPENER_RING_ACTION_STATE = "ringActionState";
77     public static final String CHANNEL_OPENER_RING_ACTION_TIMESTAMP = "ringActionTimestamp";
78
79     // List of all config-description parameters
80     public static final String CONFIG_IP = "ip";
81     public static final String CONFIG_PORT = "port";
82     public static final String CONFIG_MANAGECB = "manageCallbacks";
83     public static final String CONFIG_API_TOKEN = "apiToken";
84     public static final String CONFIG_UNLATCH = "unlatch";
85     public static final String CONFIG_SECURE_TOKEN = "secureToken";
86
87     // Nuki Bridge API Lock Actions
88     public static final int LOCK_ACTIONS_UNLOCK = 1;
89     public static final int LOCK_ACTIONS_LOCK = 2;
90     public static final int LOCK_ACTIONS_UNLATCH = 3;
91     public static final int LOCK_ACTIONS_LOCKNGO_UNLOCK = 4;
92     public static final int LOCK_ACTIONS_LOCKNGO_UNLATCH = 5;
93
94     // Nuki Bridge API Lock States
95     public static final int LOCK_STATES_UNCALIBRATED = 0;
96     public static final int LOCK_STATES_LOCKED = 1;
97     public static final int LOCK_STATES_UNLOCKING = 2;
98     public static final int LOCK_STATES_UNLOCKED = 3;
99     public static final int LOCK_STATES_LOCKING = 4;
100     public static final int LOCK_STATES_UNLATCHED = 5;
101     public static final int LOCK_STATES_UNLOCKED_LOCKNGO = 6;
102     public static final int LOCK_STATES_UNLATCHING = 7;
103     public static final int LOCK_STATES_MOTOR_BLOCKED = 254;
104     public static final int LOCK_STATES_UNDEFINED = 255;
105
106     // Nuki Binding additional Lock States
107     public static final int LOCK_STATES_UNLOCKING_LOCKNGO = 1002;
108     public static final int LOCK_STATES_UNLATCHING_LOCKNGO = 1007;
109
110     // Nuki Binding Door States
111     public static final int DOORSENSOR_STATES_UNAVAILABLE = 0;
112     public static final int DOORSENSOR_STATES_DEACTIVATED = 1;
113     public static final int DOORSENSOR_STATES_CLOSED = 2;
114     public static final int DOORSENSOR_STATES_OPEN = 3;
115     public static final int DOORSENSOR_STATES_UNKNOWN = 4;
116     public static final int DOORSENSOR_STATES_CALIBRATING = 5;
117
118     // trigger channel events
119     public static final String EVENT_RINGING = "RINGING";
120 }