Adding additional IDs for logs related to Email notifications.
MODIFY
src/authorization/Authorizations.ts
src/authorization/Authorizations.ts
@@ -993,6 +993,9 @@ export default class Authorizations {
chargingStation,
{
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
badgeID: tagID,
evseDashboardURL: Utils.buildEvseURL(tenant.subdomain),
}

MODIFY
src/integration/smart-charging/SmartChargingIntegration.ts
src/integration/smart-charging/SmartChargingIntegration.ts
@@ -156,6 +156,9 @@ export default abstract class SmartChargingIntegration<T extends SmartChargingSe
// Notify Admins
await NotificationHandler.sendComputeAndApplyChargingProfilesFailed(tenant, chargingStation,
{ chargeBoxID: chargingProfile.chargingStationID,
+ siteID: chargingProfile.chargingStation?.siteID,
+ siteAreaID: chargingProfile.chargingStation?.siteAreaID,
+ companyID: chargingProfile.chargingStation?.companyID,
siteAreaName: siteAreaName,
evseDashboardURL: Utils.buildEvseURL()
});

MODIFY
src/notification/email/EMailNotificationTask.ts
src/notification/email/EMailNotificationTask.ts
@@ -188,6 +188,10 @@ export default class EMailNotificationTask implements NotificationTask {
// No suitable main SMTP server configuration found to send the email
await Logging.logError({
tenantID: tenant.id,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
action: ServerAction.EMAIL_NOTIFICATION,
module: MODULE_NAME, method: 'sendEmail',
@@ -200,6 +204,10 @@ export default class EMailNotificationTask implements NotificationTask {
// No suitable backup SMTP server configuration found or activated to send the email
await Logging.logError({
tenantID: tenant.id,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
action: ServerAction.EMAIL_NOTIFICATION,
module: MODULE_NAME, method: 'sendEmail',
@@ -228,6 +236,10 @@ export default class EMailNotificationTask implements NotificationTask {
// Email sent successfully
await Logging.logDebug({
tenantID: tenant.id ? tenant.id : Constants.DEFAULT_TENANT,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
action: ServerAction.EMAIL_NOTIFICATION,
module: MODULE_NAME, method: 'sendEmail',
@@ -244,6 +256,10 @@ export default class EMailNotificationTask implements NotificationTask {
try {
await Logging.logError({
tenantID: tenant.id ? tenant.id : Constants.DEFAULT_TENANT,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
action: ServerAction.EMAIL_NOTIFICATION,
module: MODULE_NAME, method: 'sendEmail',
@@ -418,6 +434,10 @@ export default class EMailNotificationTask implements NotificationTask {
} catch (error) {
await Logging.logError({
tenantID: tenant.id,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
action: ServerAction.EMAIL_NOTIFICATION,
module: MODULE_NAME, method: 'prepareAndSendEmail',

MODIFY
src/notification/remote-push-notification/RemotePushNotificationTask.ts
src/notification/remote-push-notification/RemotePushNotificationTask.ts
@@ -453,6 +453,10 @@ export default class RemotePushNotificationTask implements NotificationTask {
if (!user || !user.mobileToken || user.mobileToken.length === 0) {
await Logging.logDebug({
tenantID: tenant.id,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: (data && Utils.objectHasProperty(data, 'chargeBoxID') ? data['chargeBoxID'] : null),
action: ServerAction.REMOTE_PUSH_NOTIFICATION,
module: MODULE_NAME, method: 'sendRemotePushNotificationToUsers',
@@ -474,6 +478,10 @@ export default class RemotePushNotificationTask implements NotificationTask {
// Response is a message ID string.
void Logging.logDebug({
tenantID: tenant.id,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: (data && Utils.objectHasProperty(data, 'chargeBoxID') ? data['chargeBoxID'] : null),
action: ServerAction.REMOTE_PUSH_NOTIFICATION,
module: MODULE_NAME, method: 'sendRemotePushNotificationToUsers',
@@ -484,6 +492,10 @@ export default class RemotePushNotificationTask implements NotificationTask {
}).catch((error: Error) => {
void Logging.logError({
tenantID: tenant.id,
+ siteID: Utils.objectHasProperty(data, 'siteID') && data.siteID,
+ siteAreaID: Utils.objectHasProperty(data, 'siteAreaID') && data.siteID,
+ companyID: Utils.objectHasProperty(data, 'companyID') && data.companyID,
+ chargeBoxID: Utils.objectHasProperty(data, 'chargeBoxID') && data.chargeBoxID,
source: (data && Utils.objectHasProperty(data, 'chargeBoxID') ? data['chargeBoxID'] : null),
action: ServerAction.REMOTE_PUSH_NOTIFICATION,
module: MODULE_NAME, method: 'sendRemotePushNotificationToUsers',

MODIFY
src/scheduler/tasks/CheckPreparingSessionNotStartedTask.ts
src/scheduler/tasks/CheckPreparingSessionNotStartedTask.ts
@@ -39,6 +39,9 @@ export default class CheckPreparingSessionNotStartedTask extends SchedulerTask {
await NotificationHandler.sendPreparingSessionNotStarted(tenant, chargingStation, siteOwners.result[0].user, {
user: siteOwners.result[0].user,
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
connectorId: Utils.getConnectorLetterFromConnectorID(connector.connectorId),
startedOn: moment(chargingStation.connectors['statusLastChangedOn']).format('LL'),
evseDashboardChargingStationURL: Utils.buildEvseChargingStationURL(tenant.subdomain, chargingStation, '#all'),

MODIFY
src/scheduler/tasks/CheckSessionNotStartedAfterAuthorizeTask.ts
src/scheduler/tasks/CheckSessionNotStartedAfterAuthorizeTask.ts
@@ -26,6 +26,9 @@ export default class CheckSessionNotStartedAfterAuthorizeTask extends SchedulerT
await NotificationHandler.sendSessionNotStarted(tenant, notification.tagID + '-' + notification.authDate.toString(), notification.chargingStation, {
user: notification.user,
chargeBoxID: notification.chargingStation.id,
+ siteID: notification.chargingStation.siteID,
+ siteAreaID: notification.chargingStation.siteAreaID,
+ companyID: notification.chargingStation.companyID,
evseDashboardChargingStationURL: Utils.buildEvseChargingStationURL(tenant.subdomain, notification.chargingStation, '#all'),
evseDashboardURL: Utils.buildEvseURL(tenant.subdomain)
});

MODIFY
src/server/ocpp/services/OCPPService.ts
src/server/ocpp/services/OCPPService.ts
@@ -1102,6 +1102,9 @@ export default class OCPPService {
chargingStation,
{
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
connectorId: Utils.getConnectorLetterFromConnectorID(connector.connectorId),
error: this.buildStatusNotification(statusNotification),
evseDashboardURL: Utils.buildEvseURL(tenant.subdomain),
@@ -1322,6 +1325,9 @@ export default class OCPPService {
user: transaction.user,
transactionId: transaction.id,
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
connectorId: Utils.getConnectorLetterFromConnectorID(transaction.connectorId),
totalConsumption: i18nManager.formatNumber(Math.round(transaction.currentTotalConsumptionWh / 10) / 100),
stateOfCharge: transaction.currentStateOfCharge,
@@ -1346,6 +1352,9 @@ export default class OCPPService {
{
user: transaction.user,
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
transactionId: transaction.id,
connectorId: Utils.getConnectorLetterFromConnectorID(transaction.connectorId),
totalConsumption: i18nManager.formatNumber(Math.round(transaction.currentTotalConsumptionWh / 10) / 100),
@@ -1615,6 +1624,9 @@ export default class OCPPService {
'user': user,
'transactionId': transaction.id,
'chargeBoxID': chargingStation.id,
+ 'siteID': chargingStation.siteID,
+ 'siteAreaID': chargingStation.siteAreaID,
+ 'companyID': chargingStation.companyID,
'connectorId': Utils.getConnectorLetterFromConnectorID(transaction.connectorId),
'evseDashboardURL': Utils.buildEvseURL(tenant.subdomain),
'evseDashboardChargingStationURL': Utils.buildEvseTransactionURL(tenant.subdomain, transaction.id, '#inprogress')
@@ -1660,6 +1672,9 @@ export default class OCPPService {
alternateUser: (alternateUser ? alternateUser : null),
transactionId: transaction.id,
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
connectorId: Utils.getConnectorLetterFromConnectorID(transaction.connectorId),
totalConsumption: i18nManager.formatNumber(Math.round(transaction.stop.totalConsumptionWh / 10) / 100),
totalDuration: this.buildTransactionDuration(transaction),
@@ -2020,6 +2035,9 @@ export default class OCPPService {
chargingStation,
{
chargeBoxID: chargingStation.id,
+ siteID: chargingStation.siteID,
+ siteAreaID: chargingStation.siteAreaID,
+ companyID: chargingStation.companyID,
evseDashboardURL: Utils.buildEvseURL(tenant.subdomain),
evseDashboardChargingStationURL: Utils.buildEvseChargingStationURL(tenant.subdomain, chargingStation, '#all')
}

MODIFY
src/types/UserNotifications.ts
src/types/UserNotifications.ts
@@ -105,6 +105,9 @@ interface BaseNotification {
export interface EndOfChargeNotification extends BaseNotification {
user: User;
transactionId: number;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
chargeBoxID: string;
connectorId: string;
totalConsumption: string;
@@ -117,6 +120,9 @@ export interface EndOfChargeNotification extends BaseNotification {
export interface OptimalChargeReachedNotification extends BaseNotification {
user: User;
transactionId: number;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
chargeBoxID: string;
connectorId: string;
totalConsumption: string;
@@ -129,6 +135,9 @@ export interface EndOfSessionNotification extends BaseNotification {
user: User;
alternateUser: User;
transactionId: number;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
chargeBoxID: string;
connectorId: string;
totalConsumption: string;
@@ -185,6 +194,9 @@ export interface VerificationEmailNotification extends BaseNotification {
export interface ChargingStationStatusErrorNotification extends BaseNotification {
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
connectorId: string;
error: string;
evseDashboardURL: string;
@@ -193,12 +205,18 @@ export interface ChargingStationStatusErrorNotification extends BaseNotification
export interface ChargingStationRegisteredNotification extends BaseNotification {
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
evseDashboardURL: string;
evseDashboardChargingStationURL: string;
}
export interface UnknownUserBadgedNotification extends BaseNotification {
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
badgeID: string;
evseDashboardURL: string;
}
@@ -206,6 +224,9 @@ export interface UnknownUserBadgedNotification extends BaseNotification {
export interface TransactionStartedNotification extends BaseNotification {
user: User;
transactionId: number;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
chargeBoxID: string;
connectorId: string;
evseDashboardURL: string;
@@ -239,6 +260,9 @@ export interface UserAccountInactivityNotification extends BaseNotification {
export interface PreparingSessionNotStartedNotification extends BaseNotification {
user: User;
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
connectorId: string;
startedOn: string;
evseDashboardURL: string;
@@ -288,6 +312,9 @@ export interface CarCatalogSynchronizationFailedNotification extends BaseNotific
export interface ComputeAndApplyChargingProfilesFailedNotification extends BaseNotification {
siteAreaName: string;
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
evseDashboardURL: string;
}
export interface NotificationSource {
@@ -310,6 +337,9 @@ export interface Notification {
export interface SessionNotStartedNotification extends BaseNotification {
chargeBoxID: string;
+ siteID: string;
+ siteAreaID: string;
+ companyID: string;
user: User;
evseDashboardURL: string;
evseDashboardChargingStationURL: string;

Adding additional IDs for logs related to Email notifications.