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
| Field | Type | Required | Description |
|---|---|---|---|
setMonitoringData | SetMonitoringDataType[] | Required | One entry per monitor: value, type, severity, component, variable, and optionally an id to replace an existing monitor. |
[2, "19223201", "SetVariableMonitoring", {
"setMonitoringData": [{
"value": 80.0,
"type": "UpperThreshold",
"severity": 4,
"component": { "name": "TemperatureSensor", "evse": { "id": 1 } },
"variable": { "name": "Temperature" }
}]
}]Response
| Field | Type | Required | Description |
|---|---|---|---|
setMonitoringResult | SetMonitoringResultType[] | Required | One result per requested monitor, each with a status and the assigned monitor id. |
[3, "19223201", {
"setMonitoringResult": [{
"id": 55,
"status": "Accepted",
"type": "UpperThreshold",
"severity": 4,
"component": { "name": "TemperatureSensor", "evse": { "id": 1 } },
"variable": { "name": "Temperature" }
}]
}]Values
MonitorEnumType
| Value | Meaning |
|---|---|
UpperThreshold | Raise an event when the value goes above value. |
LowerThreshold | Raise an event when the value goes below value. |
Delta | Raise an event when the value changes by more than value. |
Periodic | Report the value every value seconds. |
PeriodicClockAligned | Report 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.