]> git.basschouten.com Git - openhab-addons.git/blob
c1bc9e6255d2770442f352c4f530b58fae57fa47
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.homewizard.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * Class that provides storage for the json objects obtained from HomeWizard devices.
21  *
22  * @author DaniĆ«l van Os - Initial contribution
23  *
24  */
25 @NonNullByDefault
26 public class DataPayload {
27     private int smrVersion = 0;
28     private String meterModel = "";
29     private String wifiSsid = "";
30     private int wifiStrength = 0;
31
32     @SerializedName("total_power_import_t1_kwh")
33     private double totalEnergyImportT1Kwh;
34     @SerializedName("total_power_import_t2_kwh")
35     private double totalEnergyImportT2Kwh;
36     @SerializedName("total_power_export_t1_kwh")
37     private double totalEnergyExportT1Kwh;
38     @SerializedName("total_power_export_t2_kwh")
39     private double totalEnergyExportT2Kwh;
40
41     private double activePowerW;
42     private double activePowerL1W;
43     private double activePowerL2W;
44     private double activePowerL3W;
45     private double totalGasM3;
46     private long gasTimestamp = 0;
47
48     @SerializedName("total_liter_m3")
49     private double totalWaterM3;
50     @SerializedName("active_liter_lpm")
51     private double currentWaterLPM;
52
53     /**
54      * Getter for the smart meter version
55      *
56      * @return The most recent smart meter version obtained from the API
57      */
58     public int getSmrVersion() {
59         return smrVersion;
60     }
61
62     /**
63      * Setter for the smart meter version
64      *
65      * @param smrVersion The smart meter version to set
66      */
67     public void setSmrVersion(int smrVersion) {
68         this.smrVersion = smrVersion;
69     }
70
71     /**
72      * Getter for the meter model
73      *
74      * @return meter model
75      */
76     public String getMeterModel() {
77         return meterModel;
78     }
79
80     /**
81      * Setter for the meter model
82      *
83      * @param meterModel meter model
84      */
85     public void setMeterModel(String meterModel) {
86         this.meterModel = meterModel;
87     }
88
89     /**
90      * Getter for the meter's wifi ssid
91      *
92      * @return the meter's wifi sid
93      */
94     public String getWifiSsid() {
95         return wifiSsid;
96     }
97
98     /**
99      * Setter for the wifi ssid
100      *
101      * @param wifiSsid wifi ssid
102      */
103     public void setWifiSsid(String wifiSsid) {
104         this.wifiSsid = wifiSsid;
105     }
106
107     /**
108      * Getter for the wifi rssi
109      *
110      * @return wifi rssi
111      */
112     public int getWifiStrength() {
113         return wifiStrength;
114     }
115
116     /**
117      * Setter for the wifi rssi
118      *
119      * @param wifiStrength wifi rssi
120      */
121     public void setWifiStrength(int wifiStrength) {
122         this.wifiStrength = wifiStrength;
123     }
124
125     /**
126      * Getter for the total imported energy on counter 1
127      *
128      * @return total imported energy on counter 1
129      */
130     public double getTotalEnergyImportT1Kwh() {
131         return totalEnergyImportT1Kwh;
132     }
133
134     /**
135      * Setter for the total imported energy on counter 1
136      *
137      * @param totalEnergyImportT1Kwh total imported energy on counter 1
138      */
139     public void setTotalEnergyImportT1Kwh(double totalEnergyImportT1Kwh) {
140         this.totalEnergyImportT1Kwh = totalEnergyImportT1Kwh;
141     }
142
143     /**
144      * Getter for the total imported energy on counter 2
145      *
146      * @return total imported energy on counter 2
147      */
148     public double getTotalEnergyImportT2Kwh() {
149         return totalEnergyImportT2Kwh;
150     }
151
152     /**
153      * Setter for the total imported energy on counter 2
154      *
155      * @param totalEnergyImportT2Kwh
156      */
157     public void setTotalEnergyImportT2Kwh(double totalEnergyImportT2Kwh) {
158         this.totalEnergyImportT2Kwh = totalEnergyImportT2Kwh;
159     }
160
161     /**
162      * Getter for the total exported energy on counter 1
163      *
164      * @return total exported energy on counter 1
165      */
166     public double getTotalEnergyExportT1Kwh() {
167         return totalEnergyExportT1Kwh;
168     }
169
170     /**
171      * Setter for the total exported energy on counter 1
172      *
173      * @param totalEnergyExportT1Kwh
174      */
175     public void setTotalEnergyExportT1Kwh(double totalEnergyExportT1Kwh) {
176         this.totalEnergyExportT1Kwh = totalEnergyExportT1Kwh;
177     }
178
179     /**
180      * Getter for the total exported energy on counter 2
181      *
182      * @return total exported energy on counter 2
183      */
184     public double getTotalEnergyExportT2Kwh() {
185         return totalEnergyExportT2Kwh;
186     }
187
188     /**
189      * Setter for the total exported energy on counter 2
190      *
191      * @param totalEnergyExportT2Kwh
192      */
193     public void setTotalEnergyExportT2Kwh(double totalEnergyExportT2Kwh) {
194         this.totalEnergyExportT2Kwh = totalEnergyExportT2Kwh;
195     }
196
197     /**
198      * Getter for the current active total power
199      *
200      * @return current active total power
201      */
202     public double getActivePowerW() {
203         return activePowerW;
204     }
205
206     /**
207      * Setter for the current active total power
208      *
209      * @param activePowerW
210      */
211     public void setActivePowerW(double activePowerW) {
212         this.activePowerW = activePowerW;
213     }
214
215     /**
216      * Getter for the current active total power on phase 1
217      *
218      * @return current active total power on phase 1
219      */
220     public double getActivePowerL1W() {
221         return activePowerL1W;
222     }
223
224     /**
225      * Setter for the current active power on phase 1
226      *
227      * @param activePowerL1W current active total power on phase 1
228      */
229     public void setActivePowerL1W(double activePowerL1W) {
230         this.activePowerL1W = activePowerL1W;
231     }
232
233     /**
234      * Getter for the current active total power on phase 2
235      *
236      * @return current active total power on phase 2
237      */
238     public double getActivePowerL2W() {
239         return activePowerL2W;
240     }
241
242     /**
243      * Setter for the current active power on phase 2
244      *
245      * @param activePowerL2W current active total power on phase 2
246      */
247     public void setActivePowerL2W(double activePowerL2W) {
248         this.activePowerL2W = activePowerL2W;
249     }
250
251     /**
252      * Getter for the current active total power on phase 3
253      *
254      * @return current active total power on phase 3
255      */
256     public double getActivePowerL3W() {
257         return activePowerL3W;
258     }
259
260     /**
261      * Setter for the current active power on phase 3
262      *
263      * @param activePowerL3W current active total power on phase 3
264      */
265     public void setActivePowerL3W(double activePowerL3W) {
266         this.activePowerL3W = activePowerL3W;
267     }
268
269     /**
270      * Getter for the total imported gas volume
271      *
272      * @return total imported gas volume
273      */
274     public double getTotalGasM3() {
275         return totalGasM3;
276     }
277
278     /**
279      * Setter for the total imported gas volume
280      *
281      * @param totalGasM3 total imported gas volume
282      */
283     public void setTotalGasM3(double totalGasM3) {
284         this.totalGasM3 = totalGasM3;
285     }
286
287     /**
288      * Getter for the time stamp of the last gas update
289      *
290      * @return time stamp of the last gas update
291      */
292     public long getGasTimestamp() {
293         return gasTimestamp;
294     }
295
296     /**
297      * Setter for the time stamp of the last gas update
298      *
299      * @param gasTimestamp time stamp of the last gas update
300      */
301     public void setGasTimestamp(long gasTimestamp) {
302         this.gasTimestamp = gasTimestamp;
303     }
304
305     /**
306      * Getter for the total imported water volume
307      *
308      * @return total imported water volume
309      */
310     public double getTotalWaterM3() {
311         return totalWaterM3;
312     }
313
314     /**
315      * Setter for the total imported water volume
316      *
317      * @param totalWaterM3 total imported water volume
318      */
319     public void setTotalWaterM3(double totalWaterM3) {
320         this.totalWaterM3 = totalWaterM3;
321     }
322
323     /**
324      * Getter for the current water flow
325      *
326      * @return current water flow
327      */
328     public double getCurrentWaterLPM() {
329         return currentWaterLPM;
330     }
331
332     /**
333      * Setter for the current water flow
334      *
335      * @param currentWaterLPM current water flow
336      */
337     public void setCurrentWaterLPM(double currentWaterLPM) {
338         this.currentWaterLPM = currentWaterLPM;
339     }
340
341     @Override
342     public String toString() {
343         return String.format(
344                 """
345                         Data [smrVersion: %d meterModel: %s wifiSsid: %s wifiStrength: %d"
346                         totalEnergyImportT1Kwh: %f totalEnergyImportT2Kwh: %f totalEnergyExportT1Kwh: %f totalEnergyExportT2Kwh: %f"
347                         activePowerW: %f activePowerL1W: %f activePowerL2W: %f activePowerL3W: %f totalGasM3: %f gasTimestamp: %.0f"
348                         totalWaterM3: %f currentWaterLPM: %f]
349                         """,
350                 smrVersion, meterModel, wifiSsid, wifiStrength, totalEnergyImportT1Kwh, totalEnergyImportT2Kwh,
351                 totalEnergyExportT1Kwh, totalEnergyExportT2Kwh, activePowerW, activePowerL1W, activePowerL2W,
352                 activePowerL3W, totalGasM3, gasTimestamp, totalWaterM3, currentWaterLPM);
353     }
354 }