2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.nuki.internal.constants;
16 import java.util.stream.Collectors;
17 import java.util.stream.Stream;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.core.thing.ThingTypeUID;
23 * The {@link NukiBinding} class defines common constants, which are
24 * used across the whole binding.
26 * @author Markus Katter - Initial contribution
27 * @contributer Christian Hoefler - Door sensor integration
28 * @contributer Jan Vybíral - Opener integration
31 public class NukiBindingConstants {
33 public static final String BINDING_ID = "nuki";
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");
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);
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());
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;
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";
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";
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";
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";
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;
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;
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;
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;
119 // trigger channel events
120 public static final String EVENT_RINGING = "RINGING";