Added smartChargingActive prop in consumption
MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -1104,7 +1104,6 @@ export default class OCPPService {
private async buildConsumptionWithMeterValue(tenantID: string, transaction: Transaction,
chargingStation: ChargingStation, meterValue: OCPPNormalizedMeterValue): Promise<Consumption> {
// Get the last one
- // FIXME: Handle missing lastMeterValue attribute
const lastMeterValue = transaction.lastMeterValue;
// State of Charge?
if (OCPPUtils.isSocMeterValue(meterValue)) {
@@ -1204,6 +1203,7 @@ export default class OCPPService {
consumption.limitWatts = connector.power;
consumption.limitSource = ConnectorCurrentLimitSource.CONNECTOR;
}
+ consumption.smartChargingActive = chargingStation.siteArea.smartCharging;
// Check Org
const tenant: Tenant = await TenantStorage.getTenant(tenantID);
if (Utils.isTenantComponentActive(tenant, TenantComponents.ORGANIZATION)) {

MODIFY
src/storage/mongodb/ConsumptionStorage.ts
src/storage/mongodb/ConsumptionStorage.ts
@@ -46,6 +46,7 @@ export default class ConsumptionStorage {
limitWatts: Utils.convertToInt(consumptionToSave.limitWatts),
limitSource: consumptionToSave.limitSource,
userID: Utils.convertToObjectID(consumptionToSave.userID),
+ smartChargingActive: Utils.convertToBoolean(consumptionToSave.smartChargingActive),
limitSiteAreaWatts: consumptionToSave.limitSiteAreaWatts ? Utils.convertToInt(consumptionToSave.limitSiteAreaWatts) : null,
limitSiteAreaAmps: consumptionToSave.limitSiteAreaAmps ? Utils.convertToInt(consumptionToSave.limitSiteAreaAmps) : null,
limitSiteAreaSource: consumptionToSave.limitSiteAreaSource ? consumptionToSave.limitSiteAreaSource : null,

MODIFY
src/types/Consumption.ts
src/types/Consumption.ts
@@ -30,4 +30,5 @@ export default interface Consumption {
limitSiteAreaAmps?: number;
limitSiteAreaWatts?: number;
limitSiteAreaSource?: SiteAreaLimitSource;
+ smartChargingActive?: boolean;
}

Added smartChargingActive prop in consumption