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
| Field | Type | Required | Description |
|---|---|---|---|
setVariableData | SetVariableDataType[] | Required | One entry per variable: component, variable, attributeValue, and an optional attributeType. |
[2, "19223201", "SetVariables", {
"setVariableData": [{
"component": { "name": "OCPPCommCtrlr" },
"variable": { "name": "HeartbeatInterval" },
"attributeValue": "300"
}]
}]Response
| Field | Type | Required | Description |
|---|---|---|---|
setVariableResult | SetVariableResultType[] | Required | One result per requested variable, in the same order. |
[3, "19223201", {
"setVariableResult": [{
"attributeStatus": "Accepted",
"component": { "name": "OCPPCommCtrlr" },
"variable": { "name": "HeartbeatInterval" }
}]
}]Values
SetVariableStatusEnumType
| Value | Meaning |
|---|---|
Accepted | Written and in effect. |
Rejected | The value was refused. |
UnknownComponent | No such component on this station. |
UnknownVariable | The component exists; the variable does not. |
NotSupportedAttributeType | The component and variable exist, but not that attribute type. |
RebootRequired | Stored, but takes effect only after a reset. |
AttributeEnumType
| Value | Meaning |
|---|---|
Actual | The current value. The default when attributeType is omitted. |
Target | The value being aimed at. |
MinSet | The configured minimum. |
MaxSet | The 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.