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 object obtained from the P1 meter API
22 * @author Daniƫl van Os - Initial contribution
26 public class P1Payload {
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;
49 * Getter for the smart meter version
51 * @return The most recent smart meter version obtained from the API
53 public int getSmrVersion() {
58 * Setter for the smart meter version
60 * @param smrVersion The smart meter version to set
62 public void setSmrVersion(int smrVersion) {
63 this.smrVersion = smrVersion;
67 * Getter for the meter model
71 public String getMeterModel() {
76 * Setter for the meter model
78 * @param meterModel meter model
80 public void setMeterModel(String meterModel) {
81 this.meterModel = meterModel;
85 * Getter for the meter's wifi ssid
87 * @return the meter's wifi sid
89 public String getWifiSsid() {
94 * Setter for the wifi ssid
96 * @param wifiSsid wifi ssid
98 public void setWifiSsid(String wifiSsid) {
99 this.wifiSsid = wifiSsid;
103 * Getter for the wifi rssi
107 public int getWifiStrength() {
112 * Setter for the wifi rssi
114 * @param wifiStrength wifi rssi
116 public void setWifiStrength(int wifiStrength) {
117 this.wifiStrength = wifiStrength;
121 * Getter for the total imported energy on counter 1
123 * @return total imported energy on counter 1
125 public double getTotalEnergyImportT1Kwh() {
126 return totalEnergyImportT1Kwh;
130 * Setter for the total imported energy on counter 1
132 * @param totalEnergyImportT1Kwh total imported energy on counter 1
134 public void setTotalEnergyImportT1Kwh(double totalEnergyImportT1Kwh) {
135 this.totalEnergyImportT1Kwh = totalEnergyImportT1Kwh;
139 * Getter for the total imported energy on counter 2
141 * @return total imported energy on counter 2
143 public double getTotalEnergyImportT2Kwh() {
144 return totalEnergyImportT2Kwh;
148 * Setter for the total imported energy on counter 2
150 * @param totalEnergyImportT2Kwh
152 public void setTotalEnergyImportT2Kwh(double totalEnergyImportT2Kwh) {
153 this.totalEnergyImportT2Kwh = totalEnergyImportT2Kwh;
157 * Getter for the total exported energy on counter 1
159 * @return total exported energy on counter 1
161 public double getTotalEnergyExportT1Kwh() {
162 return totalEnergyExportT1Kwh;
166 * Setter for the total exported energy on counter 1
168 * @param totalEnergyExportT1Kwh
170 public void setTotalEnergyExportT1Kwh(double totalEnergyExportT1Kwh) {
171 this.totalEnergyExportT1Kwh = totalEnergyExportT1Kwh;
175 * Getter for the total exported energy on counter 2
177 * @return total exported energy on counter 2
179 public double getTotalEnergyExportT2Kwh() {
180 return totalEnergyExportT2Kwh;
184 * Setter for the total exported energy on counter 2
186 * @param totalEnergyExportT2Kwh
188 public void setTotalEnergyExportT2Kwh(double totalEnergyExportT2Kwh) {
189 this.totalEnergyExportT2Kwh = totalEnergyExportT2Kwh;
193 * Getter for the current active total power
195 * @return current active total power
197 public double getActivePowerW() {
202 * Setter for the current active total power
204 * @param activePowerW
206 public void setActivePowerW(double activePowerW) {
207 this.activePowerW = activePowerW;
211 * Getter for the current active total power on phase 1
213 * @return current active total power on phase 1
215 public double getActivePowerL1W() {
216 return activePowerL1W;
220 * Setter for the current active power on phase 1
222 * @param activePowerL1W current active total power on phase 1
224 public void setActivePowerL1W(double activePowerL1W) {
225 this.activePowerL1W = activePowerL1W;
229 * Getter for the current active total power on phase 2
231 * @return current active total power on phase 2
233 public double getActivePowerL2W() {
234 return activePowerL2W;
238 * Setter for the current active power on phase 2
240 * @param activePowerL2W current active total power on phase 2
242 public void setActivePowerL2W(double activePowerL2W) {
243 this.activePowerL2W = activePowerL2W;
247 * Getter for the current active total power on phase 3
249 * @return current active total power on phase 3
251 public double getActivePowerL3W() {
252 return activePowerL3W;
256 * Setter for the current active power on phase 3
258 * @param activePowerL3W current active total power on phase 3
260 public void setActivePowerL3W(double activePowerL3W) {
261 this.activePowerL3W = activePowerL3W;
265 * Getter for the total imported gas volume
267 * @return total imported gas volume
269 public double getTotalGasM3() {
274 * Setter for the total imported gas volume
276 * @param totalGasM3 total imported gas volume
278 public void setTotalGasM3(double totalGasM3) {
279 this.totalGasM3 = totalGasM3;
283 * Getter for the time stamp of the last gas update
285 * @return time stamp of the last gas update
287 public long getGasTimestamp() {
292 * Setter for the time stamp of the last gas update
294 * @param gasTimestamp time stamp of the last gas update
296 public void setGasTimestamp(long gasTimestamp) {
297 this.gasTimestamp = gasTimestamp;
301 public String toString() {
302 return String.format(
304 P1 [version: %d model: %s ssid: %s signal: %d\
305 imp1: %f imp2: %f exp1: %f exp2: %f active: %f active1: %f active2: %f active3: %f gas: %f timestamp: %.0f]\
307 smrVersion, meterModel, wifiSsid, wifiStrength, totalEnergyImportT1Kwh, totalEnergyImportT2Kwh,
308 totalEnergyExportT1Kwh, totalEnergyExportT2Kwh, activePowerW, activePowerL1W, activePowerL2W,
309 activePowerL3W, totalGasM3, gasTimestamp);