]> git.basschouten.com Git - openhab-addons.git/blob
7d7ab3f83eda78d9b53f89983ae0863e25734165
[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.fineoffsetweatherstation.internal.domain;
14
15 import static org.openhab.binding.fineoffsetweatherstation.internal.domain.response.BatteryStatus.Type.LEVEL;
16 import static org.openhab.binding.fineoffsetweatherstation.internal.domain.response.BatteryStatus.Type.LEVEL_OR_DC;
17 import static org.openhab.binding.fineoffsetweatherstation.internal.domain.response.BatteryStatus.Type.LOW_HIGH;
18 import static org.openhab.binding.fineoffsetweatherstation.internal.domain.response.BatteryStatus.Type.VOLTAGE_BROAD_STEPS;
19 import static org.openhab.binding.fineoffsetweatherstation.internal.domain.response.BatteryStatus.Type.VOLTAGE_FINE_STEPS;
20
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.openhab.binding.fineoffsetweatherstation.internal.domain.response.BatteryStatus;
23
24 /**
25  * The Sensors supported by the gateway.
26  *
27  * @author Andreas Berger - Initial contribution
28  */
29 @NonNullByDefault
30 public enum Sensor {
31     WH24(LOW_HIGH),
32     WH25(LOW_HIGH),
33     WH26(LOW_HIGH),
34     WH31(LOW_HIGH),
35     WH34(VOLTAGE_FINE_STEPS),
36     WH35(VOLTAGE_FINE_STEPS),
37     WH40(VOLTAGE_BROAD_STEPS),
38     WH41(LEVEL_OR_DC),
39     WH45(LEVEL_OR_DC),
40     WH51(VOLTAGE_BROAD_STEPS),
41     WH55(LEVEL),
42     WH57(LEVEL),
43     WH65(LOW_HIGH),
44     WH68(VOLTAGE_FINE_STEPS),
45     WH80(VOLTAGE_FINE_STEPS),
46     WH90(VOLTAGE_FINE_STEPS);
47
48     private final BatteryStatus.Type batteryStatusTpe;
49
50     Sensor(BatteryStatus.Type batteryStatusTpe) {
51         this.batteryStatusTpe = batteryStatusTpe;
52     }
53
54     public BatteryStatus getBatteryStatus(byte data) {
55         return new BatteryStatus(batteryStatusTpe, data);
56     }
57 }