The Heartbeat interval is set by the CSMS in the interval field of the
BootNotification response. Best practice values: 60 s for cellular (keeps
NAT mappings alive), 180–300 s for Wi-Fi, 300–600 s for
Ethernet. Too short wastes bandwidth and CSMS resources; too long means slow
offline detection and dropped carrier NAT sessions.
What Heartbeat does
In OCPP, the Heartbeat message serves two purposes simultaneously: it acts as an application-level keepalive that proves the connection is alive, and it performs clock synchronization — the CSMS returns its current UTC time in every Heartbeat response, allowing the Charge Point to correct any clock drift.
A Charge Point SHALL send a Heartbeat request if no other OCPP message has been sent during the configured interval. In other words, Heartbeat is a fallback keepalive: if the Charge Point is actively exchanging other messages (MeterValues, StatusNotification, etc.), those messages already prove the connection is alive and Heartbeat is suppressed (Open Charge Alliance, 2015, §4.6).
Liveness signal
Proves to the CSMS that the Charge Point is connected and responsive. The CSMS uses it to detect when a charger goes offline.
Clock sync
The currentTime in the response allows the Charge Point to keep its real-time clock aligned with the CSMS, which matters for transaction timestamps and billing accuracy.
How the interval is set
The Heartbeat interval is controlled entirely by the CSMS, not the Charge Point. There are two mechanisms:
- BootNotification response — initial value. The
intervalfield in the BootNotification response sets the Heartbeat interval at the moment the Charge Point is accepted. See the BootNotification guide for the full response payload structure. - ChangeConfiguration / SetVariables — runtime update. The CSMS can push a
new Heartbeat interval at any time using
ChangeConfiguration(OCPP 1.6) with the keyHeartbeatInterval, orSetVariables(OCPP 2.0.1) targetingOCPPCommCtrlr.HeartbeatInterval. The change takes effect immediately — no reboot required.
Message format
The Heartbeat request has the simplest possible payload — an empty object. There are no
fields to send. The response contains only currentTime.
Too short vs too long
| Interval | Problems caused |
|---|---|
| Too short (< 20 s) |
|
| Too long (> 600 s on cellular) |
|
Recommended values by connection type
There is no single correct value — the optimal interval depends on the network type, the carrier's NAT timeout, the CSMS's offline-detection policy, and operational requirements. The table below gives production-tested starting points:
📡 LTE / 4G / 5G (cellular)
Most common for public charging, highway chargers, and parking facilities without wired infrastructure.
📶 Wi-Fi (shared or dedicated SSID)
Common in retail, hospitality, and workplace charging. Network quality varies widely.
🔌 Ethernet (wired LAN)
Fleets, depots, and large-site installations with dedicated wired infrastructure.
🔋 Battery-backed / solar Charge Points
Off-grid units, rural deployments, or portable charging stations on cellular.
CSMS offline detection
The CSMS dead-time window — the time it waits before marking a Charge Point offline — should be set to at least 2× the configured Heartbeat interval, ideally 3×. This gives the Charge Point two missed Heartbeat cycles before being flagged as offline, accounting for single-packet loss or transient network hiccups.
Mismatched intervals cause false offline alarms
If you change the Heartbeat interval on a Charge Point (via ChangeConfiguration)
without updating the CSMS dead-time window, the CSMS will incorrectly mark the charger
offline. Always update both values together.
A practical formula: if your Heartbeat interval is H seconds, configure the
CSMS dead-time to 3H + 30 seconds. The extra 30 seconds absorbs clock skew
and network jitter without producing false alarms.
OCPP 2.0.1 notes
The Heartbeat message is one of the very few things that did not change between OCPP 1.6 and
2.0.1. The request is still an empty object; the response still contains only
currentTime. The mechanism for setting the interval changed:
- Initial interval: still delivered in the
intervalfield of the BootNotification response. - Runtime update: uses
SetVariablestargeting componentOCPPCommCtrlr, variableHeartbeatInterval(instead ofChangeConfigurationwith keyHeartbeatInterval).
How to test
- Validate the Heartbeat frame. The request is trivially simple —
paste
[2,"hb-001","Heartbeat",]into the Validator to confirm the CSMS accepts the schema. More usefully, validate your Heartbeat response format: paste your CSMS's CALLRESULT withcurrentTimeinto the Response tab. - Simulate the full lifecycle. Open the Simulator, connect to a test CSMS, and watch the Heartbeat exchange in the message log. The Simulator shows the exact timestamp returned by the CSMS in each response, making it easy to verify clock sync.
- Test offline detection. Start the Simulator, let it send a few Heartbeats, then close the tab without a graceful disconnect. Observe how long your CSMS takes to mark the Charge Point offline — this tells you whether the dead-time window matches the configured interval.
- Simulate interval change. From your CSMS, send a
ChangeConfigurationwith a newHeartbeatIntervalwhile the Simulator is connected. Verify the Simulator's Heartbeat frequency changes in the message log without a session restart.
Rodolfo Carrillo
OCPP integration engineer and creator of OCPP Tools. All articles are verified against the official Open Charge Alliance specification and tested using the on-site tools.
Frequently asked questions
What does the OCPP Heartbeat message actually contain?
Who sets the Heartbeat interval — the Charge Point or the CSMS?
What happens if a Charge Point never sends Heartbeat?
Does a MeterValues or StatusNotification message reset the Heartbeat timer?
What is the default HeartbeatInterval in OCPP 1.6?
Can the CSMS push a new HeartbeatInterval without rebooting the Charge Point?
Sources & further reading
- · Open Charge Alliance. (2015). Open Charge Point Protocol 1.6, Edition 2, §4.6 — Heartbeat. https://openchargealliance.org/my-oca/ocpp/
- · Open Charge Alliance. (2015). Open Charge Point Protocol 1.6, Edition 2, Appendix 1 — HeartbeatInterval configuration key. https://openchargealliance.org/my-oca/ocpp/
- · Open Charge Alliance. (2020). Open Charge Point Protocol 2.0.1, Appendix H §H.1.4 — OCPPCommCtrlr.HeartbeatInterval. https://openchargealliance.org/my-oca/ocpp/