[evcc] Fix data type issues in DTO (#13710)
* [evcc] Change DTO from double to float as the higher precision is not required * [evcc] Change DTO from int/long to float * [evcc] Update JavaDoc & small improvements * [evcc] `EvccHandler`: Add exception message to the debug log Fixes https://github.com/openhab/openhab-addons/issues/13646. Avoids problems with changed data types in the future by generally using float instead of int. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
parent
71d1226505
commit
aee4d31d5b
|
@ -66,7 +66,7 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
private boolean gridConfigured = false;
|
private boolean gridConfigured = false;
|
||||||
private boolean pvConfigured = false;
|
private boolean pvConfigured = false;
|
||||||
|
|
||||||
private int targetSoC = 100;
|
private float targetSoC = 100;
|
||||||
private boolean targetTimeEnabled = false;
|
private boolean targetTimeEnabled = false;
|
||||||
private ZonedDateTime targetTimeZDT = ZonedDateTime.now().plusHours(12);
|
private ZonedDateTime targetTimeZDT = ZonedDateTime.now().plusHours(12);
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String channelIdWithoutGroup = channelUID.getIdWithoutGroup();
|
String channelIdWithoutGroup = channelUID.getIdWithoutGroup();
|
||||||
int loadpoint = Integer.parseInt(groupId.toString().substring(9));
|
int loadpoint = Integer.parseInt(groupId.substring(9));
|
||||||
EvccAPI evccAPI = this.evccAPI;
|
EvccAPI evccAPI = this.evccAPI;
|
||||||
if (evccAPI == null) {
|
if (evccAPI == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -117,7 +117,7 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
try {
|
try {
|
||||||
evccAPI.setTargetCharge(loadpoint, targetSoC, targetTimeZDT);
|
evccAPI.setTargetCharge(loadpoint, targetSoC, targetTimeZDT);
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
logger.debug("Failed to set target charge", e);
|
logger.debug("Failed to set target charge: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
*/
|
*/
|
||||||
private void refresh() {
|
private void refresh() {
|
||||||
logger.debug("Running refresh job ...");
|
logger.debug("Running refresh job ...");
|
||||||
EvccAPI evccAPI = null;
|
EvccAPI evccAPI;
|
||||||
evccAPI = this.evccAPI;
|
evccAPI = this.evccAPI;
|
||||||
if (evccAPI == null) {
|
if (evccAPI == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -194,7 +194,7 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
try {
|
try {
|
||||||
this.result = evccAPI.getResult();
|
this.result = evccAPI.getResult();
|
||||||
} catch (EvccApiException e) {
|
} catch (EvccApiException e) {
|
||||||
logger.debug("Failed to get state");
|
logger.debug("Failed to get state: ", e);
|
||||||
}
|
}
|
||||||
Result result = this.result;
|
Result result = this.result;
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
|
@ -309,28 +309,28 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
ChannelUID channel;
|
ChannelUID channel;
|
||||||
boolean batteryConfigured = this.batteryConfigured;
|
boolean batteryConfigured = this.batteryConfigured;
|
||||||
if (batteryConfigured) {
|
if (batteryConfigured) {
|
||||||
double batteryPower = result.getBatteryPower();
|
float batteryPower = result.getBatteryPower();
|
||||||
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_POWER);
|
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_POWER);
|
||||||
updateState(channel, new QuantityType<>(batteryPower, Units.WATT));
|
updateState(channel, new QuantityType<>(batteryPower, Units.WATT));
|
||||||
int batterySoC = result.getBatterySoC();
|
float batterySoC = result.getBatterySoC();
|
||||||
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_SOC);
|
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_SOC);
|
||||||
updateState(channel, new QuantityType<>(batterySoC, Units.PERCENT));
|
updateState(channel, new QuantityType<>(batterySoC, Units.PERCENT));
|
||||||
int batteryPrioritySoC = result.getBatterySoC();
|
float batteryPrioritySoC = result.getBatterySoC();
|
||||||
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_PRIORITY_SOC);
|
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_PRIORITY_SOC);
|
||||||
updateState(channel, new QuantityType<>(batteryPrioritySoC, Units.PERCENT));
|
updateState(channel, new QuantityType<>(batteryPrioritySoC, Units.PERCENT));
|
||||||
}
|
}
|
||||||
boolean gridConfigured = this.gridConfigured;
|
boolean gridConfigured = this.gridConfigured;
|
||||||
if (gridConfigured) {
|
if (gridConfigured) {
|
||||||
double gridPower = result.getGridPower();
|
float gridPower = result.getGridPower();
|
||||||
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_GRID_POWER);
|
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_GRID_POWER);
|
||||||
updateState(channel, new QuantityType<>(gridPower, Units.WATT));
|
updateState(channel, new QuantityType<>(gridPower, Units.WATT));
|
||||||
}
|
}
|
||||||
double homePower = result.getHomePower();
|
float homePower = result.getHomePower();
|
||||||
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_HOME_POWER);
|
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_HOME_POWER);
|
||||||
updateState(channel, new QuantityType<>(homePower, Units.WATT));
|
updateState(channel, new QuantityType<>(homePower, Units.WATT));
|
||||||
boolean pvConfigured = this.pvConfigured;
|
boolean pvConfigured = this.pvConfigured;
|
||||||
if (pvConfigured) {
|
if (pvConfigured) {
|
||||||
double pvPower = result.getPvPower();
|
float pvPower = result.getPvPower();
|
||||||
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_PV_POWER);
|
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_PV_POWER);
|
||||||
updateState(channel, new QuantityType<>(pvPower, Units.WATT));
|
updateState(channel, new QuantityType<>(pvPower, Units.WATT));
|
||||||
}
|
}
|
||||||
|
@ -347,22 +347,22 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
int activePhases = loadpoint.getActivePhases();
|
int activePhases = loadpoint.getActivePhases();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_ACTIVE_PHASES);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_ACTIVE_PHASES);
|
||||||
updateState(channel, new DecimalType(activePhases));
|
updateState(channel, new DecimalType(activePhases));
|
||||||
double chargeCurrent = loadpoint.getChargeCurrent();
|
float chargeCurrent = loadpoint.getChargeCurrent();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_CURRENT);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_CURRENT);
|
||||||
updateState(channel, new QuantityType<>(chargeCurrent, Units.AMPERE));
|
updateState(channel, new QuantityType<>(chargeCurrent, Units.AMPERE));
|
||||||
long chargeDuration = loadpoint.getChargeDuration();
|
long chargeDuration = loadpoint.getChargeDuration();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_DURATION);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_DURATION);
|
||||||
updateState(channel, new QuantityType<>(chargeDuration, MetricPrefix.NANO(Units.SECOND)));
|
updateState(channel, new QuantityType<>(chargeDuration, MetricPrefix.NANO(Units.SECOND)));
|
||||||
double chargePower = loadpoint.getChargePower();
|
float chargePower = loadpoint.getChargePower();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_POWER);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_POWER);
|
||||||
updateState(channel, new QuantityType<>(chargePower, Units.WATT));
|
updateState(channel, new QuantityType<>(chargePower, Units.WATT));
|
||||||
long chargeRemainingDuration = loadpoint.getChargeRemainingDuration();
|
long chargeRemainingDuration = loadpoint.getChargeRemainingDuration();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_REMAINING_DURATION);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_REMAINING_DURATION);
|
||||||
updateState(channel, new QuantityType<>(chargeRemainingDuration, MetricPrefix.NANO(Units.SECOND)));
|
updateState(channel, new QuantityType<>(chargeRemainingDuration, MetricPrefix.NANO(Units.SECOND)));
|
||||||
double chargeRemainingEnergy = loadpoint.getChargeRemainingEnergy();
|
float chargeRemainingEnergy = loadpoint.getChargeRemainingEnergy();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_REMAINING_ENERGY);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_REMAINING_ENERGY);
|
||||||
updateState(channel, new QuantityType<>(chargeRemainingEnergy, Units.WATT_HOUR));
|
updateState(channel, new QuantityType<>(chargeRemainingEnergy, Units.WATT_HOUR));
|
||||||
double chargedEnergy = loadpoint.getChargedEnergy();
|
float chargedEnergy = loadpoint.getChargedEnergy();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGED_ENERGY);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGED_ENERGY);
|
||||||
updateState(channel, new QuantityType<>(chargedEnergy, Units.WATT_HOUR));
|
updateState(channel, new QuantityType<>(chargedEnergy, Units.WATT_HOUR));
|
||||||
boolean charging = loadpoint.getCharging();
|
boolean charging = loadpoint.getCharging();
|
||||||
|
@ -380,13 +380,13 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
boolean hasVehicle = loadpoint.getHasVehicle();
|
boolean hasVehicle = loadpoint.getHasVehicle();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_HAS_VEHICLE);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_HAS_VEHICLE);
|
||||||
updateState(channel, OnOffType.from(hasVehicle));
|
updateState(channel, OnOffType.from(hasVehicle));
|
||||||
double maxCurrent = loadpoint.getMaxCurrent();
|
float maxCurrent = loadpoint.getMaxCurrent();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MAX_CURRENT);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MAX_CURRENT);
|
||||||
updateState(channel, new QuantityType<>(maxCurrent, Units.AMPERE));
|
updateState(channel, new QuantityType<>(maxCurrent, Units.AMPERE));
|
||||||
double minCurrent = loadpoint.getMinCurrent();
|
float minCurrent = loadpoint.getMinCurrent();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MIN_CURRENT);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MIN_CURRENT);
|
||||||
updateState(channel, new QuantityType<>(minCurrent, Units.AMPERE));
|
updateState(channel, new QuantityType<>(minCurrent, Units.AMPERE));
|
||||||
int minSoC = loadpoint.getMinSoC();
|
float minSoC = loadpoint.getMinSoC();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MIN_SOC);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MIN_SOC);
|
||||||
updateState(channel, new QuantityType<>(minSoC, Units.PERCENT));
|
updateState(channel, new QuantityType<>(minSoC, Units.PERCENT));
|
||||||
String mode = loadpoint.getMode();
|
String mode = loadpoint.getMode();
|
||||||
|
@ -414,19 +414,19 @@ public class EvccHandler extends BaseThingHandler {
|
||||||
String title = loadpoint.getTitle();
|
String title = loadpoint.getTitle();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_TITLE);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_TITLE);
|
||||||
updateState(channel, new StringType(title));
|
updateState(channel, new StringType(title));
|
||||||
double vehicleCapacity = loadpoint.getVehicleCapacity();
|
float vehicleCapacity = loadpoint.getVehicleCapacity();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_CAPACITY);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_CAPACITY);
|
||||||
updateState(channel, new QuantityType<>(vehicleCapacity, Units.WATT_HOUR));
|
updateState(channel, new QuantityType<>(vehicleCapacity, Units.WATT_HOUR));
|
||||||
double vehicleOdometer = loadpoint.getVehicleOdometer();
|
float vehicleOdometer = loadpoint.getVehicleOdometer();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_ODOMETER);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_ODOMETER);
|
||||||
updateState(channel, new QuantityType<>(vehicleOdometer, MetricPrefix.KILO(SIUnits.METRE)));
|
updateState(channel, new QuantityType<>(vehicleOdometer, MetricPrefix.KILO(SIUnits.METRE)));
|
||||||
boolean vehiclePresent = loadpoint.getVehiclePresent();
|
boolean vehiclePresent = loadpoint.getVehiclePresent();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_PRESENT);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_PRESENT);
|
||||||
updateState(channel, OnOffType.from(vehiclePresent));
|
updateState(channel, OnOffType.from(vehiclePresent));
|
||||||
long vehicleRange = loadpoint.getVehicleRange();
|
float vehicleRange = loadpoint.getVehicleRange();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_RANGE);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_RANGE);
|
||||||
updateState(channel, new QuantityType<>(vehicleRange, MetricPrefix.KILO(SIUnits.METRE)));
|
updateState(channel, new QuantityType<>(vehicleRange, MetricPrefix.KILO(SIUnits.METRE)));
|
||||||
int vehicleSoC = loadpoint.getVehicleSoC();
|
float vehicleSoC = loadpoint.getVehicleSoC();
|
||||||
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_SOC);
|
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_SOC);
|
||||||
updateState(channel, new QuantityType<>(vehicleSoC, Units.PERCENT));
|
updateState(channel, new QuantityType<>(vehicleSoC, Units.PERCENT));
|
||||||
String vehicleTitle = loadpoint.getVehicleTitle();
|
String vehicleTitle = loadpoint.getVehicleTitle();
|
||||||
|
|
|
@ -38,7 +38,7 @@ import com.google.gson.JsonSyntaxException;
|
||||||
public class EvccAPI {
|
public class EvccAPI {
|
||||||
private final Logger logger = LoggerFactory.getLogger(EvccAPI.class);
|
private final Logger logger = LoggerFactory.getLogger(EvccAPI.class);
|
||||||
private final Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
private String host = "";
|
private String host;
|
||||||
|
|
||||||
public EvccAPI(String host) {
|
public EvccAPI(String host) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
@ -48,9 +48,9 @@ public class EvccAPI {
|
||||||
* Make a HTTP request.
|
* Make a HTTP request.
|
||||||
*
|
*
|
||||||
* @param url full request URL
|
* @param url full request URL
|
||||||
* @param method reguest method, e.g. GET, POST
|
* @param method request method, e.g. GET, POST
|
||||||
* @return the response body
|
* @return the response body
|
||||||
* @throws {@link EvccApiException} if HTTP request failed
|
* @throws EvccApiException if HTTP request failed
|
||||||
*/
|
*/
|
||||||
private String httpRequest(String url, String method) throws EvccApiException {
|
private String httpRequest(String url, String method) throws EvccApiException {
|
||||||
try {
|
try {
|
||||||
|
@ -67,10 +67,9 @@ public class EvccAPI {
|
||||||
// API calls to evcc
|
// API calls to evcc
|
||||||
/**
|
/**
|
||||||
* Get the status from evcc.
|
* Get the status from evcc.
|
||||||
*
|
*
|
||||||
* @param host hostname of IP address of the evcc instance
|
|
||||||
* @return {@link Result} result object from API
|
* @return {@link Result} result object from API
|
||||||
* @throws {@link EvccApiException} if status request failed
|
* @throws EvccApiException if status request failed
|
||||||
*/
|
*/
|
||||||
public Result getResult() throws EvccApiException {
|
public Result getResult() throws EvccApiException {
|
||||||
final String response = httpRequest(this.host + EVCC_REST_API + "state", "GET");
|
final String response = httpRequest(this.host + EVCC_REST_API + "state", "GET");
|
||||||
|
@ -110,7 +109,7 @@ public class EvccAPI {
|
||||||
return httpRequest(this.host + EVCC_REST_API + "loadpoints/" + loadpoint + "/maxcurrent/" + maxCurrent, "POST");
|
return httpRequest(this.host + EVCC_REST_API + "loadpoints/" + loadpoint + "/maxcurrent/" + maxCurrent, "POST");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String setTargetCharge(int loadpoint, int targetSoC, ZonedDateTime targetTime) throws EvccApiException {
|
public String setTargetCharge(int loadpoint, float targetSoC, ZonedDateTime targetTime) throws EvccApiException {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
|
DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
|
||||||
return httpRequest(this.host + EVCC_REST_API + "loadpoints/" + loadpoint + "/targetcharge/" + targetSoC + "/"
|
return httpRequest(this.host + EVCC_REST_API + "loadpoints/" + loadpoint + "/targetcharge/" + targetSoC + "/"
|
||||||
+ targetTime.toLocalDateTime().format(formatter), "POST");
|
+ targetTime.toLocalDateTime().format(formatter), "POST");
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a loadpoint object of the status response (/api/state).
|
* This class represents a loadpoint object of the status response (/api/state).
|
||||||
* This DTO was written for evcc version 0.91.
|
* This DTO was written for evcc version 0.106.3
|
||||||
*
|
*
|
||||||
* @author Florian Hotze - Initial contribution
|
* @author Florian Hotze - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -28,22 +28,22 @@ public class Loadpoint {
|
||||||
private int activePhases;
|
private int activePhases;
|
||||||
|
|
||||||
@SerializedName("chargeCurrent")
|
@SerializedName("chargeCurrent")
|
||||||
private double chargeCurrent;
|
private float chargeCurrent;
|
||||||
|
|
||||||
@SerializedName("chargeDuration")
|
@SerializedName("chargeDuration")
|
||||||
private long chargeDuration;
|
private long chargeDuration;
|
||||||
|
|
||||||
@SerializedName("chargePower")
|
@SerializedName("chargePower")
|
||||||
private double chargePower;
|
private float chargePower;
|
||||||
|
|
||||||
@SerializedName("chargeRemainingDuration")
|
@SerializedName("chargeRemainingDuration")
|
||||||
private long chargeRemainingDuration;
|
private long chargeRemainingDuration;
|
||||||
|
|
||||||
@SerializedName("chargeRemainingEnergy")
|
@SerializedName("chargeRemainingEnergy")
|
||||||
private double chargeRemainingEnergy;
|
private float chargeRemainingEnergy;
|
||||||
|
|
||||||
@SerializedName("chargedEnergy")
|
@SerializedName("chargedEnergy")
|
||||||
private double chargedEnergy;
|
private float chargedEnergy;
|
||||||
|
|
||||||
@SerializedName("charging")
|
@SerializedName("charging")
|
||||||
private boolean charging;
|
private boolean charging;
|
||||||
|
@ -64,13 +64,13 @@ public class Loadpoint {
|
||||||
private int loadpoint;
|
private int loadpoint;
|
||||||
|
|
||||||
@SerializedName("maxCurrent")
|
@SerializedName("maxCurrent")
|
||||||
private double maxCurrent;
|
private float maxCurrent;
|
||||||
|
|
||||||
@SerializedName("minCurrent")
|
@SerializedName("minCurrent")
|
||||||
private double minCurrent;
|
private float minCurrent;
|
||||||
|
|
||||||
@SerializedName("minSoC")
|
@SerializedName("minSoC")
|
||||||
private int minSoC;
|
private float minSoC;
|
||||||
|
|
||||||
@SerializedName("mode")
|
@SerializedName("mode")
|
||||||
private String mode;
|
private String mode;
|
||||||
|
@ -85,7 +85,7 @@ public class Loadpoint {
|
||||||
private long pvRemaining;
|
private long pvRemaining;
|
||||||
|
|
||||||
@SerializedName("targetSoC")
|
@SerializedName("targetSoC")
|
||||||
private int targetSoC;
|
private float targetSoC;
|
||||||
|
|
||||||
@SerializedName("targetTime")
|
@SerializedName("targetTime")
|
||||||
private String targetTime;
|
private String targetTime;
|
||||||
|
@ -94,19 +94,19 @@ public class Loadpoint {
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@SerializedName("vehicleCapacity")
|
@SerializedName("vehicleCapacity")
|
||||||
private long vehicleCapacity;
|
private float vehicleCapacity;
|
||||||
|
|
||||||
@SerializedName("vehicleOdometer")
|
@SerializedName("vehicleOdometer")
|
||||||
private double vehicleOdometer;
|
private float vehicleOdometer;
|
||||||
|
|
||||||
@SerializedName("vehiclePresent")
|
@SerializedName("vehiclePresent")
|
||||||
private boolean vehiclePresent;
|
private boolean vehiclePresent;
|
||||||
|
|
||||||
@SerializedName("vehicleRange")
|
@SerializedName("vehicleRange")
|
||||||
private long vehicleRange;
|
private float vehicleRange;
|
||||||
|
|
||||||
@SerializedName("vehicleSoC")
|
@SerializedName("vehicleSoC")
|
||||||
private int vehicleSoC;
|
private float vehicleSoC;
|
||||||
|
|
||||||
@SerializedName("vehicleTitle")
|
@SerializedName("vehicleTitle")
|
||||||
private String vehicleTitle;
|
private String vehicleTitle;
|
||||||
|
@ -121,7 +121,7 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return charge current
|
* @return charge current
|
||||||
*/
|
*/
|
||||||
public double getChargeCurrent() {
|
public float getChargeCurrent() {
|
||||||
return chargeCurrent;
|
return chargeCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return charge power
|
* @return charge power
|
||||||
*/
|
*/
|
||||||
public double getChargePower() {
|
public float getChargePower() {
|
||||||
return chargePower;
|
return chargePower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,14 +149,14 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return charge remaining energy until the target SoC is reached
|
* @return charge remaining energy until the target SoC is reached
|
||||||
*/
|
*/
|
||||||
public double getChargeRemainingEnergy() {
|
public float getChargeRemainingEnergy() {
|
||||||
return chargeRemainingEnergy;
|
return chargeRemainingEnergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return charged energy
|
* @return charged energy
|
||||||
*/
|
*/
|
||||||
public double getChargedEnergy() {
|
public float getChargedEnergy() {
|
||||||
return chargedEnergy;
|
return chargedEnergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,21 +205,21 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return maximum current
|
* @return maximum current
|
||||||
*/
|
*/
|
||||||
public double getMaxCurrent() {
|
public float getMaxCurrent() {
|
||||||
return maxCurrent;
|
return maxCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return minimum current
|
* @return minimum current
|
||||||
*/
|
*/
|
||||||
public double getMinCurrent() {
|
public float getMinCurrent() {
|
||||||
return minCurrent;
|
return minCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return minimum state of charge
|
* @return minimum state of charge
|
||||||
*/
|
*/
|
||||||
public int getMinSoC() {
|
public float getMinSoC() {
|
||||||
return minSoC;
|
return minSoC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return target state of charge (SoC)
|
* @return target state of charge (SoC)
|
||||||
*/
|
*/
|
||||||
public int getTargetSoC() {
|
public float getTargetSoC() {
|
||||||
return targetSoC;
|
return targetSoC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,14 +275,14 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return vehicle's capacity
|
* @return vehicle's capacity
|
||||||
*/
|
*/
|
||||||
public double getVehicleCapacity() {
|
public float getVehicleCapacity() {
|
||||||
return vehicleCapacity;
|
return vehicleCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return vehicle's odometer
|
* @return vehicle's odometer
|
||||||
*/
|
*/
|
||||||
public double getVehicleOdometer() {
|
public float getVehicleOdometer() {
|
||||||
return vehicleOdometer;
|
return vehicleOdometer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,14 +296,14 @@ public class Loadpoint {
|
||||||
/**
|
/**
|
||||||
* @return vehicle's range
|
* @return vehicle's range
|
||||||
*/
|
*/
|
||||||
public long getVehicleRange() {
|
public float getVehicleRange() {
|
||||||
return vehicleRange;
|
return vehicleRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return vehicle's state of charge (SoC)
|
* @return vehicle's state of charge (SoC)
|
||||||
*/
|
*/
|
||||||
public int getVehicleSoC() {
|
public float getVehicleSoC() {
|
||||||
return vehicleSoC;
|
return vehicleSoC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the result object of the status response (/api/state).
|
* This class represents the result object of the status response (/api/state).
|
||||||
* This DTO was written for evcc version 0.91.
|
* This DTO was written for evcc version 0.106.3
|
||||||
*
|
*
|
||||||
* @author Florian Hotze - Initial contribution
|
* @author Florian Hotze - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
@ -24,39 +24,37 @@ public class Result {
|
||||||
// Data types from https://github.com/evcc-io/evcc/blob/master/api/api.go
|
// Data types from https://github.com/evcc-io/evcc/blob/master/api/api.go
|
||||||
// and from https://docs.evcc.io/docs/reference/configuration/messaging/#msg
|
// and from https://docs.evcc.io/docs/reference/configuration/messaging/#msg
|
||||||
|
|
||||||
// TO DO LATER
|
// "auth" is left out because it does not provide any useful information
|
||||||
// @SerializedName("auth")
|
|
||||||
// private Auth auth;
|
|
||||||
|
|
||||||
@SerializedName("batteryConfigured")
|
@SerializedName("batteryConfigured")
|
||||||
private boolean batteryConfigured;
|
private boolean batteryConfigured;
|
||||||
|
|
||||||
@SerializedName("batteryPower")
|
@SerializedName("batteryPower")
|
||||||
private double batteryPower;
|
private float batteryPower;
|
||||||
|
|
||||||
@SerializedName("batterySoC")
|
@SerializedName("batterySoC")
|
||||||
private int batterySoC;
|
private float batterySoC;
|
||||||
|
|
||||||
@SerializedName("gridConfigured")
|
@SerializedName("gridConfigured")
|
||||||
private boolean gridConfigured;
|
private boolean gridConfigured;
|
||||||
|
|
||||||
@SerializedName("gridPower")
|
@SerializedName("gridPower")
|
||||||
private double gridPower;
|
private float gridPower;
|
||||||
|
|
||||||
@SerializedName("homePower")
|
@SerializedName("homePower")
|
||||||
private double homePower;
|
private float homePower;
|
||||||
|
|
||||||
@SerializedName("loadpoints")
|
@SerializedName("loadpoints")
|
||||||
private Loadpoint[] loadpoints;
|
private Loadpoint[] loadpoints;
|
||||||
|
|
||||||
@SerializedName("prioritySoC")
|
@SerializedName("prioritySoC")
|
||||||
private double batteryPrioritySoC;
|
private float batteryPrioritySoC;
|
||||||
|
|
||||||
@SerializedName("pvConfigured")
|
@SerializedName("pvConfigured")
|
||||||
private boolean pvConfigured;
|
private boolean pvConfigured;
|
||||||
|
|
||||||
@SerializedName("pvPower")
|
@SerializedName("pvPower")
|
||||||
private double pvPower;
|
private float pvPower;
|
||||||
|
|
||||||
@SerializedName("siteTitle")
|
@SerializedName("siteTitle")
|
||||||
private String siteTitle;
|
private String siteTitle;
|
||||||
|
@ -71,21 +69,21 @@ public class Result {
|
||||||
/**
|
/**
|
||||||
* @return battery's power
|
* @return battery's power
|
||||||
*/
|
*/
|
||||||
public double getBatteryPower() {
|
public float getBatteryPower() {
|
||||||
return batteryPower;
|
return batteryPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return battery's priority state of charge
|
* @return battery's priority state of charge
|
||||||
*/
|
*/
|
||||||
public double getBatteryPrioritySoC() {
|
public float getBatteryPrioritySoC() {
|
||||||
return batteryPrioritySoC;
|
return batteryPrioritySoC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return battery's state of charge
|
* @return battery's state of charge
|
||||||
*/
|
*/
|
||||||
public int getBatterySoC() {
|
public float getBatterySoC() {
|
||||||
return batterySoC;
|
return batterySoC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,14 +97,14 @@ public class Result {
|
||||||
/**
|
/**
|
||||||
* @return grid's power
|
* @return grid's power
|
||||||
*/
|
*/
|
||||||
public double getGridPower() {
|
public float getGridPower() {
|
||||||
return gridPower;
|
return gridPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return home's power
|
* @return home's power
|
||||||
*/
|
*/
|
||||||
public double getHomePower() {
|
public float getHomePower() {
|
||||||
return homePower;
|
return homePower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +125,7 @@ public class Result {
|
||||||
/**
|
/**
|
||||||
* @return pv's power
|
* @return pv's power
|
||||||
*/
|
*/
|
||||||
public double getPvPower() {
|
public float getPvPower() {
|
||||||
return pvPower;
|
return pvPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the status response (/api/state).
|
* This class represents the status response (/api/state).
|
||||||
* This DTO was written for evcc version 0.91.
|
* This DTO was written for evcc version 0.106.3
|
||||||
*
|
*
|
||||||
* @author Florian Hotze - Initial contribution
|
* @author Florian Hotze - Initial contribution
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue