]> git.basschouten.com Git - openhab-addons.git/blob
dbc7964d118d7b059081181e4faf54e84fac701e
[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.powermax.internal.state;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * All panel zone names
19  *
20  * @author Laurent Garnier - Initial contribution
21  */
22 @NonNullByDefault
23 public enum PowermaxZoneName {
24
25     ZONE_0(0, "Attic"),
26     ZONE_1(1, "Back door"),
27     ZONE_2(2, "Basement"),
28     ZONE_3(3, "Bathroom"),
29     ZONE_4(4, "Bedroom"),
30     ZONE_5(5, "Child room"),
31     ZONE_6(6, "Closet"),
32     ZONE_7(7, "Den"),
33     ZONE_8(8, "Dining room"),
34     ZONE_9(9, "Downstairs"),
35     ZONE_10(10, "Emergency"),
36     ZONE_11(11, "Fire"),
37     ZONE_12(12, "Front door"),
38     ZONE_13(13, "Garage"),
39     ZONE_14(14, "Garage door"),
40     ZONE_15(15, "Guest room"),
41     ZONE_16(16, "Hall"),
42     ZONE_17(17, "Kitchen"),
43     ZONE_18(18, "Laundry room"),
44     ZONE_19(19, "Living room"),
45     ZONE_20(20, "Master bathroom"),
46     ZONE_21(21, "Master bedroom"),
47     ZONE_22(22, "Office"),
48     ZONE_23(23, "Upstairs"),
49     ZONE_24(24, "Utility room"),
50     ZONE_25(25, "Yard"),
51     ZONE_26(26, "Custom 1"),
52     ZONE_27(27, "Custom 2"),
53     ZONE_28(28, "Custom 3"),
54     ZONE_29(29, "Custom 4"),
55     ZONE_30(30, "Custom 5"),
56     ZONE_31(31, "Not Installed");
57
58     private final int id;
59     private String name;
60
61     private PowermaxZoneName(int id, String name) {
62         this.id = id;
63         this.name = name;
64     }
65
66     /**
67      * @return the zone id
68      */
69     public int getId() {
70         return id;
71     }
72
73     /**
74      * @return the zone name
75      */
76     public String getName() {
77         return name;
78     }
79
80     /**
81      * Update the zone name
82      *
83      * @param name the new zone name
84      */
85     public void setName(String name) {
86         this.name = name;
87     }
88
89     /**
90      * Get the ENUM value from its id
91      *
92      * @param id the zone id
93      *
94      * @return the corresponding ENUM value
95      *
96      * @throws IllegalArgumentException if no ENUM value corresponds to this id
97      */
98     public static PowermaxZoneName fromId(int id) throws IllegalArgumentException {
99         for (PowermaxZoneName zone : PowermaxZoneName.values()) {
100             if (zone.getId() == id) {
101                 return zone;
102             }
103         }
104
105         throw new IllegalArgumentException("Invalid id: " + id);
106     }
107 }