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