2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.homewizard.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import com.google.gson.annotations.SerializedName;
20 * Class that provides storage for the json objects obtained from HomeWizard devices.
22 * @author Daniƫl van Os - Initial contribution
26 public class DataPayload {
27 private int smrVersion = 0;
28 private String meterModel = "";
29 private String wifiSsid = "";
30 private int wifiStrength = 0;
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;
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;
48 @SerializedName("total_liter_m3")
49 private double totalWaterM3;
50 @SerializedName("active_liter_lpm")
51 private double currentWaterLPM;
54 * Getter for the smart meter version
56 * @return The most recent smart meter version obtained from the API
58 public int getSmrVersion() {
63 * Setter for the smart meter version
65 * @param smrVersion The smart meter version to set
67 public void setSmrVersion(int smrVersion) {
68 this.smrVersion = smrVersion;
72 * Getter for the meter model
76 public String getMeterModel() {
81 * Setter for the meter model
83 * @param meterModel meter model
85 public void setMeterModel(String meterModel) {
86 this.meterModel = meterModel;
90 * Getter for the meter's wifi ssid
92 * @return the meter's wifi sid
94 public String getWifiSsid() {
99 * Setter for the wifi ssid
101 * @param wifiSsid wifi ssid
103 public void setWifiSsid(String wifiSsid) {
104 this.wifiSsid = wifiSsid;
108 * Getter for the wifi rssi
112 public int getWifiStrength() {
117 * Setter for the wifi rssi
119 * @param wifiStrength wifi rssi
121 public void setWifiStrength(int wifiStrength) {
122 this.wifiStrength = wifiStrength;
126 * Getter for the total imported energy on counter 1
128 * @return total imported energy on counter 1
130 public double getTotalEnergyImportT1Kwh() {
131 return totalEnergyImportT1Kwh;
135 * Setter for the total imported energy on counter 1
137 * @param totalEnergyImportT1Kwh total imported energy on counter 1
139 public void setTotalEnergyImportT1Kwh(double totalEnergyImportT1Kwh) {
140 this.totalEnergyImportT1Kwh = totalEnergyImportT1Kwh;
144 * Getter for the total imported energy on counter 2
146 * @return total imported energy on counter 2
148 public double getTotalEnergyImportT2Kwh() {
149 return totalEnergyImportT2Kwh;
153 * Setter for the total imported energy on counter 2
155 * @param totalEnergyImportT2Kwh
157 public void setTotalEnergyImportT2Kwh(double totalEnergyImportT2Kwh) {
158 this.totalEnergyImportT2Kwh = totalEnergyImportT2Kwh;
162 * Getter for the total exported energy on counter 1
164 * @return total exported energy on counter 1
166 public double getTotalEnergyExportT1Kwh() {
167 return totalEnergyExportT1Kwh;
171 * Setter for the total exported energy on counter 1
173 * @param totalEnergyExportT1Kwh
175 public void setTotalEnergyExportT1Kwh(double totalEnergyExportT1Kwh) {
176 this.totalEnergyExportT1Kwh = totalEnergyExportT1Kwh;
180 * Getter for the total exported energy on counter 2
182 * @return total exported energy on counter 2
184 public double getTotalEnergyExportT2Kwh() {
185 return totalEnergyExportT2Kwh;
189 * Setter for the total exported energy on counter 2
191 * @param totalEnergyExportT2Kwh
193 public void setTotalEnergyExportT2Kwh(double totalEnergyExportT2Kwh) {
194 this.totalEnergyExportT2Kwh = totalEnergyExportT2Kwh;
198 * Getter for the current active total power
200 * @return current active total power
202 public double getActivePowerW() {
207 * Setter for the current active total power
209 * @param activePowerW
211 public void setActivePowerW(double activePowerW) {
212 this.activePowerW = activePowerW;
216 * Getter for the current active total power on phase 1
218 * @return current active total power on phase 1
220 public double getActivePowerL1W() {
221 return activePowerL1W;
225 * Setter for the current active power on phase 1
227 * @param activePowerL1W current active total power on phase 1
229 public void setActivePowerL1W(double activePowerL1W) {
230 this.activePowerL1W = activePowerL1W;
234 * Getter for the current active total power on phase 2
236 * @return current active total power on phase 2
238 public double getActivePowerL2W() {
239 return activePowerL2W;
243 * Setter for the current active power on phase 2
245 * @param activePowerL2W current active total power on phase 2
247 public void setActivePowerL2W(double activePowerL2W) {
248 this.activePowerL2W = activePowerL2W;
252 * Getter for the current active total power on phase 3
254 * @return current active total power on phase 3
256 public double getActivePowerL3W() {
257 return activePowerL3W;
261 * Setter for the current active power on phase 3
263 * @param activePowerL3W current active total power on phase 3
265 public void setActivePowerL3W(double activePowerL3W) {
266 this.activePowerL3W = activePowerL3W;
270 * Getter for the total imported gas volume
272 * @return total imported gas volume
274 public double getTotalGasM3() {
279 * Setter for the total imported gas volume
281 * @param totalGasM3 total imported gas volume
283 public void setTotalGasM3(double totalGasM3) {
284 this.totalGasM3 = totalGasM3;
288 * Getter for the time stamp of the last gas update
290 * @return time stamp of the last gas update
292 public long getGasTimestamp() {
297 * Setter for the time stamp of the last gas update
299 * @param gasTimestamp time stamp of the last gas update
301 public void setGasTimestamp(long gasTimestamp) {
302 this.gasTimestamp = gasTimestamp;
306 * Getter for the total imported water volume
308 * @return total imported water volume
310 public double getTotalWaterM3() {
315 * Setter for the total imported water volume
317 * @param totalWaterM3 total imported water volume
319 public void setTotalWaterM3(double totalWaterM3) {
320 this.totalWaterM3 = totalWaterM3;
324 * Getter for the current water flow
326 * @return current water flow
328 public double getCurrentWaterLPM() {
329 return currentWaterLPM;
333 * Setter for the current water flow
335 * @param currentWaterLPM current water flow
337 public void setCurrentWaterLPM(double currentWaterLPM) {
338 this.currentWaterLPM = currentWaterLPM;
342 public String toString() {
343 return String.format(
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]
350 smrVersion, meterModel, wifiSsid, wifiStrength, totalEnergyImportT1Kwh, totalEnergyImportT2Kwh,
351 totalEnergyExportT1Kwh, totalEnergyExportT2Kwh, activePowerW, activePowerL1W, activePowerL2W,
352 activePowerL3W, totalGasM3, gasTimestamp, totalWaterM3, currentWaterLPM);