]> git.basschouten.com Git - openhab-addons.git/blob
053a9309f7827542399cdce57dd19f1584e1bac1
[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.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     SMO40("SMO40"),
25     F750("F750"),
26     F470("F470");
27
28     private final String pumpModel;
29
30     PumpModel(String pumpModel) {
31         this.pumpModel = pumpModel;
32     }
33
34     @Override
35     public String toString() {
36         return pumpModel;
37     }
38
39     public static PumpModel getPumpModel(String pumpModel) throws IllegalArgumentException {
40         try {
41             return PumpModel.valueOf(pumpModel.toUpperCase());
42         } catch (Exception e) {
43             String description = String.format("Illegal pump model '%s'", pumpModel);
44             throw new IllegalArgumentException(description);
45         }
46     }
47 }