]> git.basschouten.com Git - openhab-addons.git/blob
d441d7bc653910c15b392429dc7f050e9c5651e4
[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.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 int DEVICE_SMART_DOOR = 3;
53     public static final int DEVICE_SMART_LOCK_3 = 4;
54
55     // Properties
56     public static final String PROPERTY_WIFI_FIRMWARE_VERSION = "wifiFirmwareVersion";
57     public static final String PROPERTY_HARDWARE_ID = "hardwareId";
58     public static final String PROPERTY_SERVER_ID = "serverId";
59     public static final String PROPERTY_FIRMWARE_VERSION = "firmwareVersion";
60     public static final String PROPERTY_NAME = "name";
61     public static final String PROPERTY_NUKI_ID = "nukiId";
62     public static final String PROPERTY_BRIDGE_ID = "bridgeId";
63     public static final String PROPERTY_DEVICE_TYPE = "deviceType";
64
65     // List of all Smart Lock Channel ids
66     public static final String CHANNEL_SMARTLOCK_LOCK = "lock";
67     public static final String CHANNEL_SMARTLOCK_STATE = "lockState";
68     public static final String CHANNEL_SMARTLOCK_LOW_BATTERY = "lowBattery";
69     public static final String CHANNEL_SMARTLOCK_KEYPAD_LOW_BATTERY = "keypadLowBattery";
70     public static final String CHANNEL_SMARTLOCK_BATTERY_LEVEL = "batteryLevel";
71     public static final String CHANNEL_SMARTLOCK_BATTERY_CHARGING = "batteryCharging";
72     public static final String CHANNEL_SMARTLOCK_DOOR_STATE = "doorsensorState";
73
74     // List of all Opener Channel ids
75     public static final String CHANNEL_OPENER_STATE = "openerState";
76     public static final String CHANNEL_OPENER_MODE = "openerMode";
77     public static final String CHANNEL_OPENER_LOW_BATTERY = "openerLowBattery";
78     public static final String CHANNEL_OPENER_RING_ACTION_STATE = "ringActionState";
79     public static final String CHANNEL_OPENER_RING_ACTION_TIMESTAMP = "ringActionTimestamp";
80
81     // List of all config-description parameters
82     public static final String CONFIG_IP = "ip";
83     public static final String CONFIG_PORT = "port";
84     public static final String CONFIG_MANAGECB = "manageCallbacks";
85     public static final String CONFIG_API_TOKEN = "apiToken";
86     public static final String CONFIG_UNLATCH = "unlatch";
87     public static final String CONFIG_SECURE_TOKEN = "secureToken";
88
89     // Nuki Bridge API Lock Actions
90     public static final int LOCK_ACTIONS_UNLOCK = 1;
91     public static final int LOCK_ACTIONS_LOCK = 2;
92     public static final int LOCK_ACTIONS_UNLATCH = 3;
93     public static final int LOCK_ACTIONS_LOCKNGO_UNLOCK = 4;
94     public static final int LOCK_ACTIONS_LOCKNGO_UNLATCH = 5;
95
96     // Nuki Bridge API Lock States
97     public static final int LOCK_STATES_UNCALIBRATED = 0;
98     public static final int LOCK_STATES_LOCKED = 1;
99     public static final int LOCK_STATES_UNLOCKING = 2;
100     public static final int LOCK_STATES_UNLOCKED = 3;
101     public static final int LOCK_STATES_LOCKING = 4;
102     public static final int LOCK_STATES_UNLATCHED = 5;
103     public static final int LOCK_STATES_UNLOCKED_LOCKNGO = 6;
104     public static final int LOCK_STATES_UNLATCHING = 7;
105     public static final int LOCK_STATES_MOTOR_BLOCKED = 254;
106     public static final int LOCK_STATES_UNDEFINED = 255;
107
108     // Nuki Binding additional Lock States
109     public static final int LOCK_STATES_UNLOCKING_LOCKNGO = 1002;
110     public static final int LOCK_STATES_UNLATCHING_LOCKNGO = 1007;
111
112     // Nuki Binding Door States
113     public static final int DOORSENSOR_STATES_UNAVAILABLE = 0;
114     public static final int DOORSENSOR_STATES_DEACTIVATED = 1;
115     public static final int DOORSENSOR_STATES_CLOSED = 2;
116     public static final int DOORSENSOR_STATES_OPEN = 3;
117     public static final int DOORSENSOR_STATES_UNKNOWN = 4;
118     public static final int DOORSENSOR_STATES_CALIBRATING = 5;
119
120     // trigger channel events
121     public static final String EVENT_RINGING = "RINGING";
122 }