private boolean gridConfigured = false;
private boolean pvConfigured = false;
- private int targetSoC = 100;
+ private float targetSoC = 100;
private boolean targetTimeEnabled = false;
private ZonedDateTime targetTimeZDT = ZonedDateTime.now().plusHours(12);
return;
}
String channelIdWithoutGroup = channelUID.getIdWithoutGroup();
- int loadpoint = Integer.parseInt(groupId.toString().substring(9));
+ int loadpoint = Integer.parseInt(groupId.substring(9));
EvccAPI evccAPI = this.evccAPI;
if (evccAPI == null) {
return;
try {
evccAPI.setTargetCharge(loadpoint, targetSoC, targetTimeZDT);
} catch (DateTimeParseException e) {
- logger.debug("Failed to set target charge", e);
+ logger.debug("Failed to set target charge: ", e);
}
}
}
*/
private void refresh() {
logger.debug("Running refresh job ...");
- EvccAPI evccAPI = null;
+ EvccAPI evccAPI;
evccAPI = this.evccAPI;
if (evccAPI == null) {
return;
try {
this.result = evccAPI.getResult();
} catch (EvccApiException e) {
- logger.debug("Failed to get state");
+ logger.debug("Failed to get state: ", e);
}
Result result = this.result;
if (result == null) {
ChannelUID channel;
boolean batteryConfigured = this.batteryConfigured;
if (batteryConfigured) {
- double batteryPower = result.getBatteryPower();
+ float batteryPower = result.getBatteryPower();
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_POWER);
updateState(channel, new QuantityType<>(batteryPower, Units.WATT));
- int batterySoC = result.getBatterySoC();
+ float batterySoC = result.getBatterySoC();
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_BATTERY_SOC);
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);
updateState(channel, new QuantityType<>(batteryPrioritySoC, Units.PERCENT));
}
boolean gridConfigured = this.gridConfigured;
if (gridConfigured) {
- double gridPower = result.getGridPower();
+ float gridPower = result.getGridPower();
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_GRID_POWER);
updateState(channel, new QuantityType<>(gridPower, Units.WATT));
}
- double homePower = result.getHomePower();
+ float homePower = result.getHomePower();
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_HOME_POWER);
updateState(channel, new QuantityType<>(homePower, Units.WATT));
boolean pvConfigured = this.pvConfigured;
if (pvConfigured) {
- double pvPower = result.getPvPower();
+ float pvPower = result.getPvPower();
channel = new ChannelUID(getThing().getUID(), "general", CHANNEL_PV_POWER);
updateState(channel, new QuantityType<>(pvPower, Units.WATT));
}
int activePhases = loadpoint.getActivePhases();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_ACTIVE_PHASES);
updateState(channel, new DecimalType(activePhases));
- double chargeCurrent = loadpoint.getChargeCurrent();
+ float chargeCurrent = loadpoint.getChargeCurrent();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_CURRENT);
updateState(channel, new QuantityType<>(chargeCurrent, Units.AMPERE));
long chargeDuration = loadpoint.getChargeDuration();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_DURATION);
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);
updateState(channel, new QuantityType<>(chargePower, Units.WATT));
long chargeRemainingDuration = loadpoint.getChargeRemainingDuration();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_CHARGE_REMAINING_DURATION);
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);
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);
updateState(channel, new QuantityType<>(chargedEnergy, Units.WATT_HOUR));
boolean charging = loadpoint.getCharging();
boolean hasVehicle = loadpoint.getHasVehicle();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_HAS_VEHICLE);
updateState(channel, OnOffType.from(hasVehicle));
- double maxCurrent = loadpoint.getMaxCurrent();
+ float maxCurrent = loadpoint.getMaxCurrent();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_MAX_CURRENT);
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);
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);
updateState(channel, new QuantityType<>(minSoC, Units.PERCENT));
String mode = loadpoint.getMode();
String title = loadpoint.getTitle();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_TITLE);
updateState(channel, new StringType(title));
- double vehicleCapacity = loadpoint.getVehicleCapacity();
+ float vehicleCapacity = loadpoint.getVehicleCapacity();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_CAPACITY);
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);
updateState(channel, new QuantityType<>(vehicleOdometer, MetricPrefix.KILO(SIUnits.METRE)));
boolean vehiclePresent = loadpoint.getVehiclePresent();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_PRESENT);
updateState(channel, OnOffType.from(vehiclePresent));
- long vehicleRange = loadpoint.getVehicleRange();
+ float vehicleRange = loadpoint.getVehicleRange();
channel = new ChannelUID(getThing().getUID(), loadpointName, CHANNEL_LOADPOINT_VEHICLE_RANGE);
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);
updateState(channel, new QuantityType<>(vehicleSoC, Units.PERCENT));
String vehicleTitle = loadpoint.getVehicleTitle();
/**
* 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
*/
private int activePhases;
@SerializedName("chargeCurrent")
- private double chargeCurrent;
+ private float chargeCurrent;
@SerializedName("chargeDuration")
private long chargeDuration;
@SerializedName("chargePower")
- private double chargePower;
+ private float chargePower;
@SerializedName("chargeRemainingDuration")
private long chargeRemainingDuration;
@SerializedName("chargeRemainingEnergy")
- private double chargeRemainingEnergy;
+ private float chargeRemainingEnergy;
@SerializedName("chargedEnergy")
- private double chargedEnergy;
+ private float chargedEnergy;
@SerializedName("charging")
private boolean charging;
private int loadpoint;
@SerializedName("maxCurrent")
- private double maxCurrent;
+ private float maxCurrent;
@SerializedName("minCurrent")
- private double minCurrent;
+ private float minCurrent;
@SerializedName("minSoC")
- private int minSoC;
+ private float minSoC;
@SerializedName("mode")
private String mode;
private long pvRemaining;
@SerializedName("targetSoC")
- private int targetSoC;
+ private float targetSoC;
@SerializedName("targetTime")
private String targetTime;
private String title;
@SerializedName("vehicleCapacity")
- private long vehicleCapacity;
+ private float vehicleCapacity;
@SerializedName("vehicleOdometer")
- private double vehicleOdometer;
+ private float vehicleOdometer;
@SerializedName("vehiclePresent")
private boolean vehiclePresent;
@SerializedName("vehicleRange")
- private long vehicleRange;
+ private float vehicleRange;
@SerializedName("vehicleSoC")
- private int vehicleSoC;
+ private float vehicleSoC;
@SerializedName("vehicleTitle")
private String vehicleTitle;
/**
* @return charge current
*/
- public double getChargeCurrent() {
+ public float getChargeCurrent() {
return chargeCurrent;
}
/**
* @return charge power
*/
- public double getChargePower() {
+ public float getChargePower() {
return chargePower;
}
/**
* @return charge remaining energy until the target SoC is reached
*/
- public double getChargeRemainingEnergy() {
+ public float getChargeRemainingEnergy() {
return chargeRemainingEnergy;
}
/**
* @return charged energy
*/
- public double getChargedEnergy() {
+ public float getChargedEnergy() {
return chargedEnergy;
}
/**
* @return maximum current
*/
- public double getMaxCurrent() {
+ public float getMaxCurrent() {
return maxCurrent;
}
/**
* @return minimum current
*/
- public double getMinCurrent() {
+ public float getMinCurrent() {
return minCurrent;
}
/**
* @return minimum state of charge
*/
- public int getMinSoC() {
+ public float getMinSoC() {
return minSoC;
}
/**
* @return target state of charge (SoC)
*/
- public int getTargetSoC() {
+ public float getTargetSoC() {
return targetSoC;
}
/**
* @return vehicle's capacity
*/
- public double getVehicleCapacity() {
+ public float getVehicleCapacity() {
return vehicleCapacity;
}
/**
* @return vehicle's odometer
*/
- public double getVehicleOdometer() {
+ public float getVehicleOdometer() {
return vehicleOdometer;
}
/**
* @return vehicle's range
*/
- public long getVehicleRange() {
+ public float getVehicleRange() {
return vehicleRange;
}
/**
* @return vehicle's state of charge (SoC)
*/
- public int getVehicleSoC() {
+ public float getVehicleSoC() {
return vehicleSoC;
}
/**
* 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
*/
// 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
- // TO DO LATER
- // @SerializedName("auth")
- // private Auth auth;
+ // "auth" is left out because it does not provide any useful information
@SerializedName("batteryConfigured")
private boolean batteryConfigured;
@SerializedName("batteryPower")
- private double batteryPower;
+ private float batteryPower;
@SerializedName("batterySoC")
- private int batterySoC;
+ private float batterySoC;
@SerializedName("gridConfigured")
private boolean gridConfigured;
@SerializedName("gridPower")
- private double gridPower;
+ private float gridPower;
@SerializedName("homePower")
- private double homePower;
+ private float homePower;
@SerializedName("loadpoints")
private Loadpoint[] loadpoints;
@SerializedName("prioritySoC")
- private double batteryPrioritySoC;
+ private float batteryPrioritySoC;
@SerializedName("pvConfigured")
private boolean pvConfigured;
@SerializedName("pvPower")
- private double pvPower;
+ private float pvPower;
@SerializedName("siteTitle")
private String siteTitle;
/**
* @return battery's power
*/
- public double getBatteryPower() {
+ public float getBatteryPower() {
return batteryPower;
}
/**
* @return battery's priority state of charge
*/
- public double getBatteryPrioritySoC() {
+ public float getBatteryPrioritySoC() {
return batteryPrioritySoC;
}
/**
* @return battery's state of charge
*/
- public int getBatterySoC() {
+ public float getBatterySoC() {
return batterySoC;
}
/**
* @return grid's power
*/
- public double getGridPower() {
+ public float getGridPower() {
return gridPower;
}
/**
* @return home's power
*/
- public double getHomePower() {
+ public float getHomePower() {
return homePower;
}
/**
* @return pv's power
*/
- public double getPvPower() {
+ public float getPvPower() {
return pvPower;
}