Enforce check on Site Area
MODIFY
src/server/ocpp/utils/OCPPUtils.ts
src/server/ocpp/utils/OCPPUtils.ts
@@ -744,7 +744,7 @@ export default class OCPPUtils {
// Get limit of the site area
consumption.limitSiteAreaWatts = 0;
// Maximum power of the Site Area provided?
- if (siteArea.maximumPower) {
+ if (siteArea && siteArea.maximumPower) {
consumption.limitSiteAreaWatts = siteArea.maximumPower;
consumption.limitSiteAreaAmps = siteArea.maximumPower / siteArea.voltage;
consumption.limitSiteAreaSource = SiteAreaLimitSource.SITE_AREA;
@@ -759,14 +759,14 @@ export default class OCPPUtils {
consumption.limitSiteAreaAmps = Math.round(consumption.limitSiteAreaWatts / siteArea.voltage);
consumption.limitSiteAreaSource = SiteAreaLimitSource.CHARGING_STATIONS;
// Save Site Area max consumption
+ if (siteArea) {
siteArea.maximumPower = consumption.limitSiteAreaWatts;
- if (siteArea.id) {
await SiteAreaStorage.saveSiteArea(tenantID, siteArea);
}
}
- }
consumption.smartChargingActive = siteArea.smartCharging;
}
+ }
public static async getChargingStationTemplate(chargingStation: ChargingStation): Promise<ChargingStationTemplate> {
let foundTemplate: ChargingStationTemplate = null;

Enforce check on Site Area