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