]> git.basschouten.com Git - openhab-addons.git/blob
f9955e9d5dd842685e66726b098274e77a5faf67
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.tellstick.internal.live.xml;
14
15 /**
16  * This enum is used to describe the value types in the Live API from telldus.
17  *
18  * @author Jarle Hjortland - Initial contribution
19  */
20 public enum LiveDataType {
21     HUMIDITY("humidity"),
22     TEMPERATURE("temp"),
23     WINDAVERAGE("wavg"),
24     WINDDIRECTION("wdir"),
25     WINDGUST("wgust"),
26     RAINRATE("rrate"),
27     RAINTOTAL("rtot"),
28     WATT("watt"),
29     LUMINATION("lum"),
30     UNKOWN("unkown");
31
32     private String name;
33
34     LiveDataType(String name) {
35         this.name = name;
36     }
37
38     public static LiveDataType fromName(String name) {
39         LiveDataType result = LiveDataType.UNKOWN;
40         for (LiveDataType m : LiveDataType.values()) {
41             if (m.name.equals(name)) {
42                 result = m;
43                 break;
44             }
45         }
46         return result;
47     }
48
49     @Override
50     public String toString() {
51         return name;
52     }
53 }