A charger's Heartbeat interval, how often it sends readings, how it behaves offline and dozens of other settings can be managed remotely through OCPP. In OCPP 1.6J there are two tools for this: GetConfiguration to read settings and ChangeConfiguration to change them. This article covers both and the points to watch in the field.
Configuration keys
OCPP 1.6J defines charger settings as "key = value" pairs. The specification lists a set of standard keys; manufacturers can add their own keys as well. Some standard keys:
- HeartbeatInterval: The Heartbeat interval (seconds).
- MeterValueSampleInterval: How often readings are sent during charging.
- MeterValuesSampledData: Which readings are sent.
- ConnectionTimeOut: How long to wait for the cable to be plugged in after authorisation.
- LocalAuthorizeOffline: Authorisation with the local list while offline.
- AuthorizeRemoteTxRequests: Whether to run Authorize for remote starts.
- NumberOfConnectors: Number of connectors (read-only).
- WebSocketPingInterval: The WebSocket ping interval.
GetConfiguration: reading settings
If the request is sent empty, the charger returns all keys. If specific keys are requested, it returns only those.
[2, "10001", "GetConfiguration", {"key": ["HeartbeatInterval", "MeterValueSampleInterval"]}]
The reply contains two lists:
- configurationKey: For each key, the
key,readonlyandvaluefields. - unknownKey: Keys the charger does not recognise.
When adding a new charger model to the network, the first job is to read all keys with an empty GetConfiguration and save them. The list shows what that model supports and which vendor-specific settings it includes.
ChangeConfiguration: changing a setting
[2, "10002", "ChangeConfiguration", {"key": "MeterValueSampleInterval", "value": "60"}]
Note that the value is always sent as text, even when it is a number. The charger's possible replies:
- Accepted: The setting changed and is effective immediately.
- Rejected: The value is invalid or the key is read-only.
- RebootRequired: The setting was saved but requires a restart to take effect.
- NotSupported: The key does not exist on the charger.
With a RebootRequired reply you need to restart the charger with a Soft Reset at a suitable time; otherwise the setting does not take effect. See the OCPP Reset command.
Read-only keys
Keys with readonly: true cannot be changed. Keys such as NumberOfConnectors or SupportedFeatureProfiles report the charger's capabilities. Trying to change them results in Rejected.
List values
Some keys take a comma-separated list. For example, for MeterValuesSampledData: Energy.Active.Import.Register,Power.Active.Import,SoC. If the list contains a reading the charger does not support, the whole change may be rejected. Details: MeterValuesSampledData.
Good practice: model-based templates
Configuring each charger one by one takes time and creates inconsistency. A better method:
- Prepare a template with recommended settings for each charger model.
- Apply the template automatically when a new charger connects with BootNotification.
- Periodically verify with GetConfiguration that settings have not changed.
- Check settings again after a firmware update; some updates restore defaults.
What changed in OCPP 2.0.1 and 2.1?
In the newer versions a device model is used instead of a flat key list. Settings are defined as components and variables; reading and writing are done with GetVariables and SetVariables, and a report of the whole configuration is requested with GetBaseReport. See our article on SetVariables and GetVariables for details.
Common mistakes
- Sending the value as a number: It should be
"value": "60", not"value": 60. Some chargers reject a number with FormationViolation. - Upper/lower case differences: Key names must be written exactly;
heartbeatintervalandHeartbeatIntervalare different. - Guessing vendor-specific keys: Changing an undocumented key can cause unpredictable behaviour on the charger.
- Not verifying the change: Reading the same key again with GetConfiguration after ChangeConfiguration shows whether the value was really applied.
Conclusion
GetConfiguration and ChangeConfiguration are the basic tools for managing OCPP 1.6J chargers remotely. Remember that values are sent as text, that read-only keys cannot be changed and that a RebootRequired reply requires a reset. Üreticy's OCPP software lets you read and change charger configuration from the dashboard, and the result of every command is recorded.
