]> git.basschouten.com Git - openhab-addons.git/blob
0286c7af2ceaa6eaa1aed25f02c2115fcb81cbe8
[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.nobohub.internal.model;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The status of the {@link WeekProfile}. What the value is in the week profile. Status OFF is matched both to value 3
19  * and 4, while the documentation says 3, Hub with Hardware version 11123610_rev._1 and production date 20180305
20  * will send value 4 for OFF.
21  * compatibility.
22  *
23  * @author Jørgen Austvik - Initial contribution
24  * @author Espen Fossen - Initial contribution
25  */
26 @NonNullByDefault
27 public enum WeekProfileStatus {
28
29     ECO(0),
30     COMFORT(1),
31     AWAY(2),
32     OFF(3);
33
34     private final int numValue;
35
36     private WeekProfileStatus(int numValue) {
37         this.numValue = numValue;
38     }
39
40     public static WeekProfileStatus getByNumber(int value) throws NoboDataException {
41         switch (value) {
42             case 0:
43                 return ECO;
44             case 1:
45                 return COMFORT;
46             case 2:
47                 return AWAY;
48             case 3:
49             case 4:
50                 return OFF;
51             default:
52                 throw new NoboDataException(String.format("Unknown week profile status  %d", value));
53         }
54     }
55
56     public int getNumValue() {
57         return numValue;
58     }
59 }