]> git.basschouten.com Git - openhab-addons.git/blob
84408e8da25414d41aea867badd8d921717e57f8
[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.nibeheatpump.internal.models;
14
15 /**
16  * Class for different Nibe heat pump models.
17  *
18  *
19  * @author Pauli Anttila - Initial contribution
20  */
21 public enum PumpModel {
22     F1X45("F1X45"),
23     F1X55("F1X55"),
24     F750("F750"),
25     F470("F470");
26
27     private final String pumpModel;
28
29     PumpModel(String pumpModel) {
30         this.pumpModel = pumpModel;
31     }
32
33     @Override
34     public String toString() {
35         return pumpModel;
36     }
37
38     public static PumpModel getPumpModel(String pumpModel) throws IllegalArgumentException {
39         try {
40             return PumpModel.valueOf(pumpModel.toUpperCase());
41         } catch (Exception e) {
42             String description = String.format("Illegal pump model '%s'", pumpModel);
43             throw new IllegalArgumentException(description);
44         }
45     }
46 }