]> git.basschouten.com Git - openhab-addons.git/blob
183531e3da0ac00fe1671c2d3840be9708165b5f
[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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * Enumeration of all lock actions Nuki Smart Lock accepts
20  *
21  * @author Jan Vybíral - Initial contribution
22  */
23 @NonNullByDefault
24 public enum SmartLockAction {
25     UNLOCK(1),
26     LOCK(2),
27     UNLATCH(3),
28     LOCK_N_GO(4),
29     LOCK_N_GO_WITH_UNLATCH(5);
30
31     private final int action;
32
33     SmartLockAction(int action) {
34         this.action = action;
35     }
36
37     public static @Nullable SmartLockAction fromAction(int action) {
38         for (SmartLockAction value : values()) {
39             if (value.action == action) {
40                 return value;
41             }
42         }
43         return null;
44     }
45
46     public int getAction() {
47         return action;
48     }
49 }