Skip to content

ChargePoint user_config_path parameter not utilized for Custom Configuration overrides as documented #1163

@ashubhatt

Description

@ashubhatt

OCPP Version

OCPP1.6

Describe the bug

The ChargePoint constructor accepts a parameter user_config_path. According to the README doc, it can be used to overwrite the settings without modifying the original config.json.

user_config_path: this points to a "user config", which we call a configuration file that's merged with the config that's provided in the "config" parameter. Here you can add, remove and overwrite settings without modifying the config passed in the first parameter directly. This is also used by libocpp to persistently modify config entries that are changed by the CSMS that should persist across restarts.

However, when I modified the settings for Custom Configurations, it had no effect on the Configuration. Looking into the code it seems the user config is only used to store settings and is never effectively read from while evaluating the configuration value.

Thus, the parameter user_config_path is not utilized correctly as per the documentation.

To Reproduce

To reproduce this issue:

  1. Add a custom configuration in the profile_schemas/Custom.json. Then edit the profile_schemas/Config.json to include the profile_schemas/Custom.json schema.
  2. After that add some default value of this newly added custom configuration in config.json file.
  3. Overwrite the value of this custom configuration by providing a different value in the user_config.json (this file needs to be provided in the user_config_path).
  4. Start the application and trigger GetConfiguration.req from the CSMS.
  5. Observe the value of the Custom configuration.

Expectation:
The configuration value should be same as the value provided in the user_config.json

Observation:
The configuration value is observed to be same as the value in the config.json

Anything else?

$ cat profile_schemas/Custom.json
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "description": "Json schema for Custom configuration keys",
    "$comment": "JSON schema to support configurations as per Custom requirements",
    "type": "object",
    "required": [],
    "properties": {
        "SampleConfig": {
            "type": "boolean",
            "readOnly": false,
            "description": "Indicates if the sample configuration is enabled"
        }
    }
}
$ cat profile_schemas/Config.json  | tail
            "type": "object",
            "$ref": "CostAndPrice.json"
        },
        "Custom": {
            "type": "object",
            "$ref": "Custom.json"
        }
    },
    "additionalProperties": false
}
$ cat config.json | tail
        "CertificateStoreMaxLength": 1000,
        "CpoName": "Pionix",
        "SecurityProfile": 1,
        "DisableSecurityEventNotifications": false
    },
    "Custom": {
        "SampleConfig": false
    }
$ cat user_config.json  | jq
{
  "Custom": {
    "SampleConfig": true
  }
}

Observed OCPP Logs:

[INFO][341]: 0000000000000000: send [2,"7d26fe50-d4d6-4bbe-a66a-91635cfa22f3","GetConfiguration",{"key":["SampleConfig"]}]
[INFO][125]: 0000000000000000: receive message [3,"7d26fe50-d4d6-4bbe-a66a-91635cfa22f3",{"configurationKey":[{"key":"SampleConfig","readonly":false,"value":"false"}]}]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions