SetVariables

Writes device model variables. Replaces 1.6's flat ChangeConfiguration key/value writes.

Version
OCPP 2.0.1
Direction
CSMS → Charge Point
Functional block
Provisioning

1.6 configuration was a flat map of string keys. 2.0.1 replaces it with the device model: a variable is addressed by the component it belongs to and its own name, and both can be further qualified by instance and EVSE.

So where 1.6 wrote HeartbeatInterval, 2.0.1 writes the HeartbeatInterval variable on the OCPPCommCtrlr component. Several variables can be set in one request, and each gets its own result.

Request

FieldTypeRequiredDescription
setVariableDataSetVariableDataType[]RequiredOne entry per variable: component, variable, attributeValue, and an optional attributeType.
json
[2, "19223201", "SetVariables", {
  "setVariableData": [{
    "component": { "name": "OCPPCommCtrlr" },
    "variable": { "name": "HeartbeatInterval" },
    "attributeValue": "300"
  }]
}]

Response

FieldTypeRequiredDescription
setVariableResultSetVariableResultType[]RequiredOne result per requested variable, in the same order.
json
[3, "19223201", {
  "setVariableResult": [{
    "attributeStatus": "Accepted",
    "component": { "name": "OCPPCommCtrlr" },
    "variable": { "name": "HeartbeatInterval" }
  }]
}]

Values

SetVariableStatusEnumType

ValueMeaning
AcceptedWritten and in effect.
RejectedThe value was refused.
UnknownComponentNo such component on this station.
UnknownVariableThe component exists; the variable does not.
NotSupportedAttributeTypeThe component and variable exist, but not that attribute type.
RebootRequiredStored, but takes effect only after a reset.

AttributeEnumType

ValueMeaning
ActualThe current value. The default when attributeType is omitted.
TargetThe value being aimed at.
MinSetThe configured minimum.
MaxSetThe configured maximum.

Implementation notes

`UnknownComponent` and `UnknownVariable` are different failures. 1.6 had one NotSupported; 2.0.1 tells you whether you addressed the wrong component or the wrong variable on the right one. Log which you got.

Values are still strings, exactly as in 1.6 — "300", not 300, even for numeric variables.

`RebootRequired` means nothing changed yet. Follow with a Reset, as in 1.6.

The response array is per-variable. A batch write can partly succeed, and a CSMS that checks only the first result will believe the whole batch applied.