[goecharger] fix data type for energy (nrg) (#13052)
* [goecharger] fix data type for energy (nrg) * nrg need to be double for V2 * [goecharger] update example Signed-off-by: Reinhard Plaim <reinhardplaim@gmail.com>
This commit is contained in:
@@ -27,9 +27,6 @@ public class GoEStatusResponseBaseDTO {
|
||||
@SerializedName("amp")
|
||||
public Integer maxCurrent;
|
||||
|
||||
@SerializedName("nrg")
|
||||
public Integer[] energy;
|
||||
|
||||
@SerializedName("err")
|
||||
public Integer errorCode;
|
||||
|
||||
|
||||
@@ -45,4 +45,7 @@ public class GoEStatusResponseDTO extends GoEStatusResponseBaseDTO {
|
||||
|
||||
@SerializedName("amx")
|
||||
public Integer maxCurrentTemporary;
|
||||
|
||||
@SerializedName("nrg")
|
||||
public Integer[] energy;
|
||||
}
|
||||
|
||||
@@ -41,4 +41,7 @@ public class GoEStatusResponseV2DTO extends GoEStatusResponseBaseDTO {
|
||||
|
||||
@SerializedName("frc")
|
||||
public Integer forceState;
|
||||
|
||||
@SerializedName("nrg")
|
||||
public Double[] energy;
|
||||
}
|
||||
|
||||
@@ -87,21 +87,6 @@ public abstract class GoEChargerBaseHandler extends BaseThingHandler {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new StringType(goeResponseBase.firmware);
|
||||
case VOLTAGE_L1:
|
||||
if (goeResponseBase.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponseBase.energy[0], Units.VOLT);
|
||||
case VOLTAGE_L2:
|
||||
if (goeResponseBase.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponseBase.energy[1], Units.VOLT);
|
||||
case VOLTAGE_L3:
|
||||
if (goeResponseBase.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponseBase.energy[2], Units.VOLT);
|
||||
}
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,26 @@ public class GoEChargerHandler extends GoEChargerBaseHandler {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[9] * 100, Units.WATT);
|
||||
case POWER_ALL:
|
||||
if (goeResponseBase.energy == null) {
|
||||
case VOLTAGE_L1:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponseBase.energy[11] * 10, Units.WATT);
|
||||
return new QuantityType<>(goeResponse.energy[0], Units.VOLT);
|
||||
case VOLTAGE_L2:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[1], Units.VOLT);
|
||||
case VOLTAGE_L3:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[2], Units.VOLT);
|
||||
case POWER_ALL:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[11] * 10, Units.WATT);
|
||||
}
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
|
||||
@@ -152,53 +152,67 @@ public class GoEChargerV2Handler extends GoEChargerBaseHandler {
|
||||
if (goeResponse.sessionChargeConsumption == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>((Double) (goeResponse.sessionChargeConsumption / 1000d), Units.KILOWATT_HOUR);
|
||||
return new QuantityType<>(goeResponse.sessionChargeConsumption / 1000d, Units.KILOWATT_HOUR);
|
||||
case SESSION_CHARGE_CONSUMPTION_LIMIT:
|
||||
if (goeResponse.sessionChargeConsumptionLimit == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>((Double) (goeResponse.sessionChargeConsumptionLimit / 1000d),
|
||||
Units.KILOWATT_HOUR);
|
||||
return new QuantityType<>(goeResponse.sessionChargeConsumptionLimit / 1000d, Units.KILOWATT_HOUR);
|
||||
case TOTAL_CONSUMPTION:
|
||||
if (goeResponse.totalChargeConsumption == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>((Double) (goeResponse.totalChargeConsumption / 1000d), Units.KILOWATT_HOUR);
|
||||
case VOLTAGE_L1:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[0], Units.VOLT);
|
||||
case VOLTAGE_L2:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[1], Units.VOLT);
|
||||
case VOLTAGE_L3:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[2], Units.VOLT);
|
||||
case CURRENT_L1:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>((Double) (goeResponse.energy[4] / 1000d), Units.AMPERE);
|
||||
return new QuantityType<>(goeResponse.energy[4], Units.AMPERE);
|
||||
case CURRENT_L2:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>((Double) (goeResponse.energy[5] / 1000d), Units.AMPERE);
|
||||
return new QuantityType<>(goeResponse.energy[5], Units.AMPERE);
|
||||
case CURRENT_L3:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>((Double) (goeResponse.energy[6] / 1000d), Units.AMPERE);
|
||||
return new QuantityType<>(goeResponse.energy[6], Units.AMPERE);
|
||||
case POWER_L1:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[7] * 1000, Units.WATT);
|
||||
return new QuantityType<>(goeResponse.energy[7], Units.WATT);
|
||||
case POWER_L2:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[8] * 1000, Units.WATT);
|
||||
return new QuantityType<>(goeResponse.energy[8], Units.WATT);
|
||||
case POWER_L3:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[9] * 1000, Units.WATT);
|
||||
return new QuantityType<>(goeResponse.energy[9], Units.WATT);
|
||||
case POWER_ALL:
|
||||
if (goeResponse.energy == null) {
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
return new QuantityType<>(goeResponse.energy[11] * 1000, Units.WATT);
|
||||
return new QuantityType<>(goeResponse.energy[11], Units.WATT);
|
||||
case FORCE_STATE:
|
||||
if (goeResponse.forceState == null) {
|
||||
return UnDefType.UNDEF;
|
||||
|
||||
Reference in New Issue
Block a user