const unknownKey: string[] = []
if (key == null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- for (const configuration of chargingStation.ocppConfiguration!.configurationKey!) {
- if (configuration.visible == null) {
- configuration.visible = true
- }
- if (!configuration.visible) {
+ for (const configKey of chargingStation.ocppConfiguration!.configurationKey!) {
+ if (!OCPP16ServiceUtils.isConfigurationKeyVisible(configKey)) {
continue
}
configurationKey.push({
- key: configuration.key,
- readonly: configuration.readonly,
- value: configuration.value
+ key: configKey.key,
+ readonly: configKey.readonly,
+ value: configKey.value
})
}
} else if (isNotEmptyArray(key)) {
for (const k of key) {
const keyFound = getConfigurationKey(chargingStation, k, true)
if (keyFound != null) {
- if (keyFound.visible == null) {
- keyFound.visible = true
- }
- if (!keyFound.visible) {
+ if (!OCPP16ServiceUtils.isConfigurationKeyVisible(keyFound)) {
continue
}
configurationKey.push({
hasReservationExpired
} from '../../../charging-station/index.js'
import {
+ type ConfigurationKey,
type GenericResponse,
type JsonType,
OCPP16AuthorizationStatus,
type OCPP16SupportedFeatureProfiles,
OCPPVersion
} from '../../../types/index.js'
-import { isNotEmptyArray, logger, roundTo } from '../../../utils/index.js'
+import { cloneObject, isNotEmptyArray, logger, roundTo } from '../../../utils/index.js'
import { OCPPServiceUtils } from '../OCPPServiceUtils.js'
export class OCPP16ServiceUtils extends OCPPServiceUtils {
}
}
+ public static isConfigurationKeyVisible (key: ConfigurationKey): boolean {
+ if (key.visible == null) {
+ key = cloneObject(key)
+ key.visible = true
+ }
+ return key.visible
+ }
+
public static hasReservation = (
chargingStation: ChargingStation,
connectorId: number,