"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 2},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 30},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 1},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 20},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 2},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 30},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 2},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 20},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 2},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 20},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 2},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 30},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 3},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 30},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 3},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 30},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
"randomConnectors": false,
"Configuration": { "configurationKey": [
{ "key": "NumberOfConnectors", "readonly": true, "value": 9},
- { "key": "param1", "readonly": false, "value": "test"},
{ "key": "MeterValueSampleInterval", "readonly": false, "value": 30},
+ { "key": "SupportedFeatureProfiles", "readonly": true, "value": "Core,LocalAuthListManagement"},
+ { "key": "LocalAuthListEnabled", "readonly": false, "value": false},
{ "key": "AuthorizeRemoteTxRequests", "readonly": false, "value": false}
]
},
// eslint-disable-next-line class-methods-use-this
async startTransaction(connectorId, self) {
- if (self._chargingStation.isAuthorizationRequested()) {
+ if (self._chargingStation.hasAuthorizationKeys()) {
const tagId = self._chargingStation.getRandomTagId();
logger.info(self._basicFormatLog(connectorId) + ' start transaction for tagID ' + tagId);
return self._chargingStation.sendStartTransaction(connectorId, tagId);
return authorizeRemoteTxRequests ? Utils.convertToBoolean(authorizeRemoteTxRequests.value) : false;
}
+ _getLocalAuthListEnabled() {
+ const localAuthListEnabled = this._configuration.configurationKey.find((configElement) => configElement.key === 'LocalAuthListEnabled');
+ return localAuthListEnabled ? Utils.convertToBoolean(localAuthListEnabled.value) : false;
+ }
+
_buildChargingStation(index, stationTemplate) {
if (Array.isArray(stationTemplate.power)) {
stationTemplate.maxPower = stationTemplate.power[Math.floor(Math.random() * stationTemplate.power.length)];
logger.info(this._basicFormatLog() + ' Will communicate with ' + this._supervisionUrl);
this._url = this._supervisionUrl + '/' + this._stationInfo.name;
this._wsConnection = new WebSocket(this._url, 'ocpp1.6');
- if (this._authorizationFile !== '') {
+ if (this._authorizationFile) {
try {
// load file
const fileDescriptor = fs.openSync(this._authorizationFile, 'r');
this._authorizedKeys = JSON.parse(fs.readFileSync(fileDescriptor, 'utf8'));
fs.closeSync(fileDescriptor);
- // get remote authorization logic
- // FIXME: move to the constructor
- this._authorizeRemoteTxRequests = this._getAuthorizeRemoteTxRequests();
// monitor authorization file
// eslint-disable-next-line no-unused-vars
fs.watchFile(this._authorizationFile, (current, previous) => {
} catch (error) {
logger.error(this._basicFormatLog() + ' Authorization file error: ' + error);
}
+ } else {
+ logger.info(this._basicFormatLog() + ' No authorization file given in template ' + this._stationInfo.baseName);
}
// Handle Socket incoming messages
this._wsConnection.on('message', this.onMessage.bind(this));
if (payload.idTagInfo.status === 'Accepted') {
for (const connector in this._connectors) {
- if (Utils.convertToInt(connector) === requestPayload.connectorId) {
+ if (Utils.convertToInt(connector) === Utils.convertToInt(requestPayload.connectorId)) {
this._connectors[connector].transactionStarted = true;
this._connectors[connector].transactionId = payload.transactionId;
this._connectors[connector].lastConsumptionValue = 0;
} else {
logger.error(this._basicFormatLog() + ' Starting transaction id ' + payload.transactionId + ' REJECTED with status ' + payload.idTagInfo.status + ', idTag ' + requestPayload.idTag);
for (const connector in this._connectors) {
- if (Utils.convertToInt(connector) === requestPayload.connectorId) {
+ if (Utils.convertToInt(connector) === Utils.convertToInt(requestPayload.connectorId)) {
this._resetTransactionOnConnector(connector);
}
}
async handleRemoteStartTransaction(commandPayload) {
const transactionConnectorID = (commandPayload.connectorId ? commandPayload.connectorId : '1');
- if (this.isAuthorizationRequested() && this._authorizeRemoteTxRequests) {
+ if (this.hasAuthorizationKeys() && this._getLocalAuthListEnabled() && this._getAuthorizeRemoteTxRequests()) {
// Check if authorized
if (this._authorizedKeys.find((value) => value === commandPayload.idTag)) {
// Authorization successful start transaction
return Constants.OCPP_RESPONSE_ACCEPTED;
}
- isAuthorizationRequested() {
+ hasAuthorizationKeys() {
return this._authorizedKeys && this._authorizedKeys.length > 0;
}