GetVariables

Configuration CSMS->CS OCPP 2.0.1

Sent by the CSMS to retrieve one or more variable values from the Charging Station. Replaces GetConfiguration from OCPP 1.6J with a structured Component/Variable model.

Quick Reference

Required Fields

getVariableData array[GetVariableDataType]

List of variables to retrieve, each with component and variable objects

Optional Fields

getVariableData[].attributeType AttributeEnumType

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

Example Payload

{
  "getVariableData": [
    {
      "component": {
        "name": "SmartChargingCtrlr"
      },
      "variable": {
        "name": "Enabled"
      }
    },
    {
      "component": {
        "name": "HeartbeatCtrlr"
      },
      "variable": {
        "name": "HeartbeatInterval"
      }
    }
  ]
}

Example Full Frame

[
  2,
  "msg-001",
  "GetVariables",
  {
    "getVariableData": [
      {
        "component": {
          "name": "SmartChargingCtrlr"
        },
        "variable": {
          "name": "Enabled"
        }
      },
      {
        "component": {
          "name": "HeartbeatCtrlr"
        },
        "variable": {
          "name": "HeartbeatInterval"
        }
      }
    ]
  }
]

Format: [MessageType, MessageId, Action, Payload]

Overview

GetVariables retrieves configuration values from the Charging Station using a structured Component/Variable model. It replaces GetConfiguration from OCPP 1.6J.

When to Send

  • To read the current heartbeat interval or other configuration values
  • To audit Charging Station settings during commissioning
  • To verify a variable value after setting it with SetVariables

Expected Response

The Charging Station responds with:

  • getVariableResult: Array of results, one per requested variable
    • attributeStatus: Accepted, Rejected, UnknownComponent, UnknownVariable, or NotSupportedAttributeType
    • attributeValue: The current value (if Accepted)

Key Differences from OCPP 1.6J

OCPP 1.6JOCPP 2.0.1
GetConfigurationGetVariables
key: ["HeartbeatInterval"]getVariableData: [{ component: { name: "..." }, variable: { name: "..." } }]
Returns all keys if emptyMust specify each variable explicitly

Usage Notes

  • Common component names: HeartbeatCtrlr, SmartChargingCtrlr, AuthCacheCtrlr, OCPPCommCtrlr
  • attributeType: "Actual" returns the current operating value (default)
  • Use GetBaseReport to discover all available variables on a station

Testing Tips

  • Request HeartbeatCtrlr/HeartbeatInterval and verify the returned value matches behavior
  • Test with an unknown component name and verify UnknownComponent response
  • Test attributeType: "Target" vs "Actual" for variables with pending changes

Common Errors

TypeConstraintViolation

Cause: Sending a flat key string instead of component/variable objects

Solution: OCPP 2.0.1 uses structured Component/Variable pairs, not flat key names like GetConfiguration

PropertyConstraintViolation

Cause: getVariableData array is empty

Solution: Include at least one GetVariableDataType entry in the array