SetVariables

Configuration CSMS->CS OCPP 2.0.1

Sent by the CSMS to update one or more configuration variable values on the Charging Station. Replaces ChangeConfiguration from OCPP 1.6J.

Quick Reference

Required Fields

setVariableData array[SetVariableDataType]

List of variables to set, each with component, variable, and attributeValue

setVariableData[].attributeValue string(1000)

The new value to set for the variable

setVariableData[].component ComponentType

Component that owns the variable

setVariableData[].variable VariableType

Variable to set

Optional Fields

setVariableData[].attributeType AttributeEnumType

Attribute to set: Actual (default), Target, MinSet, MaxSet

Example Payload

{
  "setVariableData": [
    {
      "component": {
        "name": "HeartbeatCtrlr"
      },
      "variable": {
        "name": "HeartbeatInterval"
      },
      "attributeValue": "60"
    },
    {
      "component": {
        "name": "SmartChargingCtrlr"
      },
      "variable": {
        "name": "Enabled"
      },
      "attributeValue": "true"
    }
  ]
}

Example Full Frame

[
  2,
  "msg-001",
  "SetVariables",
  {
    "setVariableData": [
      {
        "component": {
          "name": "HeartbeatCtrlr"
        },
        "variable": {
          "name": "HeartbeatInterval"
        },
        "attributeValue": "60"
      },
      {
        "component": {
          "name": "SmartChargingCtrlr"
        },
        "variable": {
          "name": "Enabled"
        },
        "attributeValue": "true"
      }
    ]
  }
]

Format: [MessageType, MessageId, Action, Payload]

Overview

SetVariables updates configuration variables on the Charging Station using the Component/Variable model. It replaces ChangeConfiguration from OCPP 1.6J.

When to Send

  • To update the heartbeat interval
  • To enable or disable smart charging
  • To configure meter value reporting intervals
  • Any time a Charging Station configuration parameter needs to change

Expected Response

The Charging Station responds with:

  • setVariableResult: Array of results, one per variable
    • attributeStatus: Accepted, Rejected, UnknownComponent, UnknownVariable, NotSupportedAttributeType, or RebootRequired

RebootRequired means the change will only take effect after a Charging Station restart.

Key Differences from OCPP 1.6J

OCPP 1.6JOCPP 2.0.1
ChangeConfigurationSetVariables
key: "HeartbeatInterval", value: "60"component/variable/attributeValue structure
Single key-value pairMultiple variables in one request

Usage Notes

  • All attributeValue values are strings, even for numbers and booleans: "60", "true"
  • A single SetVariables request can change multiple variables at once
  • Check each result individually — partial success is possible

Testing Tips

  • Set HeartbeatInterval and verify the station starts heartbeating at the new interval
  • Test setting a read-only variable and verify Rejected response
  • Test RebootRequired scenario and verify the variable takes effect after Reset

Common Errors

TypeConstraintViolation

Cause: Sending key/value pairs instead of component/variable objects

Solution: OCPP 2.0.1 requires structured component and variable objects, not flat key strings

PropertyConstraintViolation

Cause: attributeValue exceeds 1000 characters

Solution: Keep attribute values under 1000 characters