Skip to content

Commit

Permalink
[homewizard] Fix NumberFormatException (#17792)
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
  • Loading branch information
lsiepel authored Nov 23, 2024
1 parent 37c6d6b commit 7ece8ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public class DataPayload {
private int longPowerFailCount;

@SerializedName("active_voltage_v")
private int activeVoltage;
private double activeVoltage;
@SerializedName("active_voltage_l1_v")
private int activeVoltageL1;
private double activeVoltageL1;
@SerializedName("active_voltage_l2_v")
private int activeVoltageL2;
private double activeVoltageL2;
@SerializedName("active_voltage_l3_v")
private int activeVoltageL3;
private double activeVoltageL3;

@SerializedName("active_current_a")
private double activeCurrent;
Expand Down Expand Up @@ -175,7 +175,7 @@ public int getLongPowerFailCount() {
*
* @return current active voltage
*/
public int getActiveVoltage() {
public double getActiveVoltage() {
return activeVoltage;
}

Expand All @@ -184,7 +184,7 @@ public int getActiveVoltage() {
*
* @return active voltage on phase 1
*/
public int getActiveVoltageL1() {
public double getActiveVoltageL1() {
return activeVoltageL1;
}

Expand All @@ -193,7 +193,7 @@ public int getActiveVoltageL1() {
*
* @return active voltage on phase 2
*/
public int getActiveVoltageL2() {
public double getActiveVoltageL2() {
return activeVoltageL2;
}

Expand All @@ -202,7 +202,7 @@ public int getActiveVoltageL2() {
*
* @return active voltage on phase 3
*/
public int getActiveVoltageL3() {
public double getActiveVoltageL3() {
return activeVoltageL3;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public void deserializeResponse() throws IOException {
assertThat(key.getActivePowerL1W(), is(-676));
assertThat(key.getActivePowerL2W(), is(133));
assertThat(key.getActivePowerL3W(), is(18));
assertThat(key.getActiveVoltage(), is(220));
assertThat(key.getActiveVoltageL1(), is(221));
assertThat(key.getActiveVoltageL2(), is(222));
assertThat(key.getActiveVoltageL3(), is(223));
assertThat(key.getActiveVoltage(), is(220.0));
assertThat(key.getActiveVoltageL1(), is(221.0));
assertThat(key.getActiveVoltageL2(), is(222.0));
assertThat(key.getActiveVoltageL3(), is(223.0));
assertThat(key.getTotalEnergyExportT1Kwh(), is(8874.0));
assertThat(key.getTotalEnergyExportT2Kwh(), is(7788.0));
assertThat(key.getTotalEnergyImportT1Kwh(), is(10830.511));
Expand Down Expand Up @@ -80,10 +80,10 @@ public void deserializeResponseEmpty() throws IOException {
assertThat(key.getActivePowerL1W(), is(0));
assertThat(key.getActivePowerL2W(), is(0));
assertThat(key.getActivePowerL3W(), is(0));
assertThat(key.getActiveVoltage(), is(0));
assertThat(key.getActiveVoltageL1(), is(0));
assertThat(key.getActiveVoltageL2(), is(0));
assertThat(key.getActiveVoltageL3(), is(0));
assertThat(key.getActiveVoltage(), is(0.0));
assertThat(key.getActiveVoltageL1(), is(0.0));
assertThat(key.getActiveVoltageL2(), is(0.0));
assertThat(key.getActiveVoltageL3(), is(0.0));
assertThat(key.getAnyPowerFailCount(), is(0));
assertThat(key.getLongPowerFailCount(), is(0));
assertThat(key.getTotalEnergyExportT1Kwh(), is(0.0));
Expand Down

0 comments on commit 7ece8ad

Please sign in to comment.