SetVariableMonitoring

Asks the station to watch a variable and raise a NotifyEvent when it crosses a threshold or changes.

Version
OCPP 2.0.1
Direction
CSMS → Charge Point
Functional block
Diagnostics

This is the mechanism that replaces polling. Rather than reading a variable repeatedly, the CSMS installs a monitor and the station reports when something happens.

Only variables whose variableCharacteristics.supportsMonitoring is true can be monitored — NotifyReport tells you which those are.

Request

FieldTypeRequiredDescription
setMonitoringDataSetMonitoringDataType[]RequiredOne entry per monitor: value, type, severity, component, variable, and optionally an id to replace an existing monitor.
json
[2, "19223201", "SetVariableMonitoring", {
  "setMonitoringData": [{
    "value": 80.0,
    "type": "UpperThreshold",
    "severity": 4,
    "component": { "name": "TemperatureSensor", "evse": { "id": 1 } },
    "variable": { "name": "Temperature" }
  }]
}]

Response

FieldTypeRequiredDescription
setMonitoringResultSetMonitoringResultType[]RequiredOne result per requested monitor, each with a status and the assigned monitor id.
json
[3, "19223201", {
  "setMonitoringResult": [{
    "id": 55,
    "status": "Accepted",
    "type": "UpperThreshold",
    "severity": 4,
    "component": { "name": "TemperatureSensor", "evse": { "id": 1 } },
    "variable": { "name": "Temperature" }
  }]
}]

Values

MonitorEnumType

ValueMeaning
UpperThresholdRaise an event when the value goes above value.
LowerThresholdRaise an event when the value goes below value.
DeltaRaise an event when the value changes by more than value.
PeriodicReport the value every value seconds.
PeriodicClockAlignedReport at clock-aligned intervals of value seconds.

Implementation notes

Keep the returned monitor `id`. ClearVariableMonitoring deletes by id, and without it the only way to remove a monitor is to enumerate them with GetMonitoringReport.

severity here sets the severity of the events the monitor will raise — the same inverted 0-to-9 scale, where 0 is most severe.

Monitors on frequently changing variables generate a lot of traffic. Delta with a sensible threshold beats Periodic on a metered connection.