[homewizard] Fix NumberFormatException (#17792)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2024-11-23 21:16:16 +01:00 committed by GitHub
parent 37c6d6b3eb
commit 7ece8ad86d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 16 deletions

View File

@ -58,13 +58,13 @@ public class DataPayload {
private int longPowerFailCount; private int longPowerFailCount;
@SerializedName("active_voltage_v") @SerializedName("active_voltage_v")
private int activeVoltage; private double activeVoltage;
@SerializedName("active_voltage_l1_v") @SerializedName("active_voltage_l1_v")
private int activeVoltageL1; private double activeVoltageL1;
@SerializedName("active_voltage_l2_v") @SerializedName("active_voltage_l2_v")
private int activeVoltageL2; private double activeVoltageL2;
@SerializedName("active_voltage_l3_v") @SerializedName("active_voltage_l3_v")
private int activeVoltageL3; private double activeVoltageL3;
@SerializedName("active_current_a") @SerializedName("active_current_a")
private double activeCurrent; private double activeCurrent;
@ -175,7 +175,7 @@ public class DataPayload {
* *
* @return current active voltage * @return current active voltage
*/ */
public int getActiveVoltage() { public double getActiveVoltage() {
return activeVoltage; return activeVoltage;
} }
@ -184,7 +184,7 @@ public class DataPayload {
* *
* @return active voltage on phase 1 * @return active voltage on phase 1
*/ */
public int getActiveVoltageL1() { public double getActiveVoltageL1() {
return activeVoltageL1; return activeVoltageL1;
} }
@ -193,7 +193,7 @@ public class DataPayload {
* *
* @return active voltage on phase 2 * @return active voltage on phase 2
*/ */
public int getActiveVoltageL2() { public double getActiveVoltageL2() {
return activeVoltageL2; return activeVoltageL2;
} }
@ -202,7 +202,7 @@ public class DataPayload {
* *
* @return active voltage on phase 3 * @return active voltage on phase 3
*/ */
public int getActiveVoltageL3() { public double getActiveVoltageL3() {
return activeVoltageL3; return activeVoltageL3;
} }

View File

@ -47,10 +47,10 @@ public class P1PayloadTest {
assertThat(key.getActivePowerL1W(), is(-676)); assertThat(key.getActivePowerL1W(), is(-676));
assertThat(key.getActivePowerL2W(), is(133)); assertThat(key.getActivePowerL2W(), is(133));
assertThat(key.getActivePowerL3W(), is(18)); assertThat(key.getActivePowerL3W(), is(18));
assertThat(key.getActiveVoltage(), is(220)); assertThat(key.getActiveVoltage(), is(220.0));
assertThat(key.getActiveVoltageL1(), is(221)); assertThat(key.getActiveVoltageL1(), is(221.0));
assertThat(key.getActiveVoltageL2(), is(222)); assertThat(key.getActiveVoltageL2(), is(222.0));
assertThat(key.getActiveVoltageL3(), is(223)); assertThat(key.getActiveVoltageL3(), is(223.0));
assertThat(key.getTotalEnergyExportT1Kwh(), is(8874.0)); assertThat(key.getTotalEnergyExportT1Kwh(), is(8874.0));
assertThat(key.getTotalEnergyExportT2Kwh(), is(7788.0)); assertThat(key.getTotalEnergyExportT2Kwh(), is(7788.0));
assertThat(key.getTotalEnergyImportT1Kwh(), is(10830.511)); assertThat(key.getTotalEnergyImportT1Kwh(), is(10830.511));
@ -80,10 +80,10 @@ public class P1PayloadTest {
assertThat(key.getActivePowerL1W(), is(0)); assertThat(key.getActivePowerL1W(), is(0));
assertThat(key.getActivePowerL2W(), is(0)); assertThat(key.getActivePowerL2W(), is(0));
assertThat(key.getActivePowerL3W(), is(0)); assertThat(key.getActivePowerL3W(), is(0));
assertThat(key.getActiveVoltage(), is(0)); assertThat(key.getActiveVoltage(), is(0.0));
assertThat(key.getActiveVoltageL1(), is(0)); assertThat(key.getActiveVoltageL1(), is(0.0));
assertThat(key.getActiveVoltageL2(), is(0)); assertThat(key.getActiveVoltageL2(), is(0.0));
assertThat(key.getActiveVoltageL3(), is(0)); assertThat(key.getActiveVoltageL3(), is(0.0));
assertThat(key.getAnyPowerFailCount(), is(0)); assertThat(key.getAnyPowerFailCount(), is(0));
assertThat(key.getLongPowerFailCount(), is(0)); assertThat(key.getLongPowerFailCount(), is(0));
assertThat(key.getTotalEnergyExportT1Kwh(), is(0.0)); assertThat(key.getTotalEnergyExportT1Kwh(), is(0.0));