"configurationKey": [
{
"key": "AllowOfflineTxForUnknownId",
+ "readonly": false,
"value": "True"
},
{
},
{
"key": "MeterValueSampleInterval",
+ "readonly": false,
"value": "300"
},
{
"key": "TransactionMessageAttempts",
+ "readonly": false,
"value": "3"
},
{
"key": "TransactionMessageRetryInterval",
+ "readonly": false,
"value": "20"
},
{
StandardParametersKey.ReserveConnectorZeroSupported,
buildConfigKey(OCPP20ComponentName.ReservationCtrlr, StandardParametersKey.NonEvseSpecific),
],
+ [
+ StandardParametersKey.HeartbeatInterval,
+ buildConfigKey(OCPP20ComponentName.OCPPCommCtrlr, StandardParametersKey.HeartbeatInterval),
+ ],
+ [
+ StandardParametersKey.HeartBeatInterval,
+ buildConfigKey(OCPP20ComponentName.OCPPCommCtrlr, StandardParametersKey.HeartbeatInterval),
+ ],
+ [
+ StandardParametersKey.WebSocketPingInterval,
+ buildConfigKey(
+ OCPP20ComponentName.ChargingStation,
+ StandardParametersKey.WebSocketPingInterval
+ ),
+ ],
] as [ConfigurationKeyType, ConfigurationKeyType][]
).map(([from, to]) => [
from,
UploadLogStatusEnumType,
} from '../../../types/index.js'
import {
+ convertToBoolean,
convertToDate,
generateUUID,
logger,
variable: { name: 'AllowReset' },
},
])
- if (allowResetResults.length > 0 && allowResetResults[0].attributeValue === 'false') {
+ if (
+ allowResetResults.length > 0 &&
+ allowResetResults[0].attributeValue != null &&
+ !convertToBoolean(allowResetResults[0].attributeValue)
+ ) {
logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: AllowReset is false, rejecting reset request`
)
variable: { name: 'AllowSecurityProfileDowngrade' },
},
])
- const allowDowngrade = allowDowngradeResults[0]?.attributeValue?.toLowerCase() === 'true'
+ const allowDowngrade = convertToBoolean(allowDowngradeResults[0]?.attributeValue)
// B09.FR.31 (errata 2025-09 §2.12): Allow downgrade except to profile 1 when enabled
if (!allowDowngrade || newSecurityProfile <= 1) {
},
])
const shouldAuthorizeRemoteStart =
- authorizeRemoteStartResults[0]?.attributeValue?.toLowerCase() !== 'false'
+ authorizeRemoteStartResults[0]?.attributeValue == null ||
+ convertToBoolean(authorizeRemoteStartResults[0].attributeValue)
let isAuthorized = true
if (shouldAuthorizeRemoteStart) {
variable: { name: 'SimulateSignatureVerificationFailure' },
},
])
- const simulateFailure = verificationResults[0]?.attributeValue?.toLowerCase() === 'true'
+ const simulateFailure = convertToBoolean(verificationResults[0]?.attributeValue)
if (simulateFailure) {
// L01.FR.03: InvalidSignature + SecurityEventNotification
variable: { name: 'AllowNewSessionsPendingFirmwareUpdate' },
},
])
- const allowNewSessions = allowNewSessionsResults[0]?.attributeValue?.toLowerCase() === 'true'
+ const allowNewSessions = convertToBoolean(allowNewSessionsResults[0]?.attributeValue)
while (
!checkAborted() &&
[...chargingStation.evses].some(
isOCPP20RequiredVariableName(variable.name) &&
variable.name === OCPP20RequiredVariableName.AuthorizeRemoteStart
) {
- if (attributeValue !== 'true' && attributeValue !== 'false') {
+ if (attributeValue.toLowerCase() !== 'true' && attributeValue.toLowerCase() !== 'false') {
return this.rejectSet(
variable,
component,
}
switch (variableMetadata.dataType) {
case DataEnumType.boolean: {
- if (rawValue !== 'true' && rawValue !== 'false') {
+ if (rawValue.toLowerCase() !== 'true' && rawValue.toLowerCase() !== 'false') {
return {
info: 'Boolean must be "true" or "false"',
ok: false,
RequestCommand,
StandardParametersKey,
} from '../../../../types/index.js'
-import { logger, truncateId } from '../../../../utils/index.js'
+import { convertToBoolean, logger, truncateId } from '../../../../utils/index.js'
import {
AuthContext,
AuthenticationMethod,
this.chargingStation,
StandardParametersKey.AllowOfflineTxForUnknownId
)
- return configKey?.value === 'true'
+ return convertToBoolean(configKey?.value)
} catch (error) {
logger.warn(
`${this.chargingStation.logPrefix()} ${moduleName}.getOfflineTransactionConfig: Error getting offline transaction config`,
// Check the type
if (typeof value === 'boolean') {
return value
- } else if (typeof value === 'string' && (value.toLowerCase() === 'true' || value === '1')) {
+ } else if (
+ typeof value === 'string' &&
+ (value.trim().toLowerCase() === 'true' || value === '1')
+ ) {
result = true
} else if (typeof value === 'number' && value === 1) {
result = true
await it('should not resolve unmapped keys on OCPP 2.0.1 station', () => {
// Arrange
const cs = createStationForVersion(OCPPVersion.VERSION_201)
- addConfigurationKey(cs, StandardParametersKey.HeartbeatInterval, '30', undefined, {
+ addConfigurationKey(cs, StandardParametersKey.NumberOfConnectors, '2', undefined, {
save: false,
})
// Act
- const k = getConfigurationKey(cs, StandardParametersKey.HeartbeatInterval)
+ const k = getConfigurationKey(cs, StandardParametersKey.NumberOfConnectors)
// Assert
if (k == null) {
assert.fail('Expected configuration key to be found')
}
- assert.strictEqual(k.key, StandardParametersKey.HeartbeatInterval)
+ assert.strictEqual(k.key, StandardParametersKey.NumberOfConnectors)
})
})
})
await it('should reject invalid values for AuthorizeRemoteStart (AuthCtrlr)', () => {
- const invalidValues = ['', '1', 'TRUE', 'False', 'yes']
+ const invalidValues = ['', '1', 'yes']
for (const val of invalidValues) {
const res = manager.setVariables(station, [
{
// Check the type
if (typeof value === 'boolean') {
return value
- } else if (typeof value === 'string' && (value.toLowerCase() === 'true' || value === '1')) {
+ } else if (
+ typeof value === 'string' &&
+ (value.trim().toLowerCase() === 'true' || value === '1')
+ ) {
result = true
} else if (typeof value === 'number' && value === 1) {
result = true