Fixed badge got always inactive
MODIFY
package.json
package.json
{
"name": "ev-server",
- "version": "2.3.5",
+ "version": "2.3.6",
"engines": {
"node": "12.x.x"
},

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -944,14 +944,8 @@ export default class OCPPService {
await this.updateOCPIStatus(tenantID, chargingStation, foundConnector);
// Save
await ChargingStationStorage.saveChargingStation(tenantID, chargingStation);
- // Start Transaction in OCPP: trigger Smart Charging
- if (oldConnectorStatus &&
- (statusNotification.status === ChargePointStatus.CHARGING ||
- statusNotification.status === ChargePointStatus.SUSPENDED_EV ||
- statusNotification.status === ChargePointStatus.SUSPENDED_EVSE) &&
- (oldConnectorStatus === ChargePointStatus.PREPARING ||
- oldConnectorStatus === ChargePointStatus.AVAILABLE)) {
- // Handle Smart Charging
+ // Trigger Smart Charging
+ if (statusNotification.status === ChargePointStatus.CHARGING) {
try {
// Trigger Smart Charging
await this.triggerSmartCharging(tenantID, chargingStation);

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
@@ -284,8 +284,8 @@ export default class UserStorage {
const tagMDB = {
_id: tag.id,
userID: Utils.convertToObjectID(userID),
- issuer: tag.issuer,
- active: tag.active,
+ issuer: Utils.convertToBoolean(tag.issuer),
+ active: Utils.convertToBoolean(tag.active),
ocpiToken: tag.ocpiToken,
description: tag.description
};
@@ -690,12 +690,7 @@ export default class UserStorage {
}
}
// Debug
- Logging.traceEnd(MODULE_NAME, 'getUsers', uniqueTimerID, {
- params,
- limit,
- skip,
- sort: dbParams.sort
- });
+ Logging.traceEnd(MODULE_NAME, 'getUsers', uniqueTimerID, { params });
// Ok
return {
count: (usersCountMDB.length > 0 ?

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -1282,8 +1282,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Site ID is mandatory',
- module: MODULE_NAME,
- method: 'checkIfSiteValid',
+ module: MODULE_NAME, method: 'checkIfSiteValid',
user: req.user.id
});
}
@@ -1292,8 +1291,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Site Name is mandatory',
- module: MODULE_NAME,
- method: 'checkIfSiteValid',
+ module: MODULE_NAME, method: 'checkIfSiteValid',
user: req.user.id
});
}
@@ -1302,8 +1300,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Company ID is mandatory for the Site',
- module: MODULE_NAME,
- method: 'checkIfSiteValid',
+ module: MODULE_NAME, method: 'checkIfSiteValid',
user: req.user.id
});
}
@@ -1315,8 +1312,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Site Area ID is mandatory',
- module: MODULE_NAME,
- method: 'checkIfSiteAreaValid',
+ module: MODULE_NAME, method: 'checkIfSiteAreaValid',
user: req.user.id
});
}
@@ -1325,8 +1321,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Site Area name is mandatory',
- module: MODULE_NAME,
- method: 'checkIfSiteAreaValid',
+ module: MODULE_NAME, method: 'checkIfSiteAreaValid',
user: req.user.id
});
}
@@ -1335,8 +1330,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Site ID is mandatory',
- module: MODULE_NAME,
- method: 'checkIfSiteAreaValid',
+ module: MODULE_NAME, method: 'checkIfSiteAreaValid',
user: req.user.id
});
}
@@ -1346,8 +1340,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: `Site maximum power must be a positive number but got ${siteArea.maximumPower} kW`,
- module: MODULE_NAME,
- method: 'checkIfSiteAreaValid',
+ module: MODULE_NAME, method: 'checkIfSiteAreaValid',
user: req.user.id
});
}
@@ -1356,8 +1349,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: `Site voltage must be either 110V or 230V but got ${siteArea.voltage} kW`,
- module: MODULE_NAME,
- method: 'checkIfSiteAreaValid',
+ module: MODULE_NAME, method: 'checkIfSiteAreaValid',
user: req.user.id
});
}
@@ -1366,8 +1358,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: `Site area number of phases must be either 1 or 3 but got ${siteArea.numberOfPhases}`,
- module: MODULE_NAME,
- method: 'checkIfSiteAreaValid',
+ module: MODULE_NAME, method: 'checkIfSiteAreaValid',
user: req.user.id
});
}
@@ -1379,8 +1370,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Company ID is mandatory',
- module: MODULE_NAME,
- method: 'checkIfCompanyValid',
+ module: MODULE_NAME, method: 'checkIfCompanyValid',
user: req.user.id
});
}
@@ -1389,8 +1379,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Company Name is mandatory',
- module: MODULE_NAME,
- method: 'checkIfCompanyValid',
+ module: MODULE_NAME, method: 'checkIfCompanyValid',
user: req.user.id
});
}
@@ -1406,8 +1395,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Asset ID is mandatory',
- module: MODULE_NAME,
- method: 'checkIfAssetValid',
+ module: MODULE_NAME, method: 'checkIfAssetValid',
user: req.user.id
});
}
@@ -1416,8 +1404,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Asset Name is mandatory',
- module: MODULE_NAME,
- method: 'checkIfAssetValid',
+ module: MODULE_NAME, method: 'checkIfAssetValid',
user: req.user.id
});
}
@@ -1426,8 +1413,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Asset Site Area is mandatory',
- module: MODULE_NAME,
- method: 'checkIfAssetValid',
+ module: MODULE_NAME, method: 'checkIfAssetValid',
user: req.user.id
});
}
@@ -1436,8 +1422,7 @@ export default class Utils {
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.GENERAL_ERROR,
message: 'Asset type is mandatory',
- module: MODULE_NAME,
- method: 'checkIfAssetValid',
+ module: MODULE_NAME, method: 'checkIfAssetValid',
user: req.user.id
});
}
@@ -1448,6 +1433,7 @@ export default class Utils {
if (Authorizations.isAdmin(req.user) || Authorizations.isSuperAdmin(req.user)) {
if (tags) {
for (const tag of tags) {
+ // Check if exists
const foundUser = await UserStorage.getUserByTagId(req.user.tenantID, tag.id);
if (foundUser && (!user || (foundUser.id !== user.id))) {
// Tag already used!
@@ -1460,6 +1446,25 @@ export default class Utils {
user: req.user.id
});
}
+ // Check params
+ if (!tag.id) {
+ throw new AppError({
+ source: Constants.CENTRAL_SERVER,
+ errorCode: HTTPError.GENERAL_ERROR,
+ message: 'Tag ID is mandatory',
+ module: MODULE_NAME, method: 'checkIfUserTagsAreValid',
+ user: req.user.id
+ });
+ }
+ if (!Utils.objectHasProperty(tag, 'active')) {
+ throw new AppError({
+ source: Constants.CENTRAL_SERVER,
+ errorCode: HTTPError.GENERAL_ERROR,
+ message: 'Tag Active property is mandatory',
+ module: MODULE_NAME, method: 'checkIfUserTagsAreValid',
+ user: req.user.id
+ });
+ }
}
}
}

Fixed badge got always inactive