]> git.basschouten.com Git - openhab-addons.git/blob
d7d7bbae7615f61465bc2248c0d16281f157e880
[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.jeelink.internal.lacrosse;
14
15 /**
16  * Reading of a TX22 Temperature/Humidity Sensor.
17  *
18  * @author Volker Bier - Initial contribution
19  */
20 public class Tx22Reading extends LaCrosseTemperatureReading {
21     private Integer rain;
22     private Float windDirection;
23     private Float windSpeed;
24     private Float windGust;
25     private Integer pressure;
26
27     public Tx22Reading(int sensorId, int sensorType, int channel, Float temp, Integer humidity, boolean batteryNew,
28             boolean batteryLow, Integer rain, Float windDirection, Float windSpeed, Float windGust, Integer pressure) {
29         super(String.valueOf(sensorId), sensorType, channel, temp, humidity, batteryNew, batteryLow);
30
31         this.rain = rain;
32         this.windDirection = windDirection;
33         this.windSpeed = windSpeed;
34         this.windGust = windGust;
35         this.pressure = pressure;
36     }
37
38     public Integer getRain() {
39         return rain;
40     }
41
42     public Float getWindDirection() {
43         return windDirection;
44     }
45
46     public Float getWindSpeed() {
47         return windSpeed;
48     }
49
50     public Float getWindGust() {
51         return windGust;
52     }
53
54     public Integer getPressure() {
55         return pressure;
56     }
57
58     public boolean hasWindGust() {
59         return windGust != null;
60     }
61
62     public boolean hasWindSpeed() {
63         return windSpeed != null;
64     }
65
66     public boolean hasWindDirection() {
67         return windDirection != null;
68     }
69
70     public boolean hasPressure() {
71         return pressure != null;
72     }
73
74     public boolean hasRain() {
75         return rain != null;
76     }
77
78     public boolean hasHumidity() {
79         return getHumidity() != null;
80     }
81
82     public boolean hasTemperature() {
83         return getTemperature() != null;
84     }
85
86     @Override
87     public String toString() {
88         return super.toString() + " rain=" + rain + " windDirection=" + windDirection + " windSpeed=" + windSpeed
89                 + " windGust=" + windGust + " pressure=" + pressure;
90     }
91 }