A charger must tell its management software that it is online even when it has not charged for a long time. The OCPP message used for this is called Heartbeat. The message itself is very simple, but how often it is sent affects both fault detection and mobile data costs.

What does Heartbeat do?

Heartbeat has three main jobs:

  1. Liveness: The CSMS knows the charger is connected and working.
  2. Clock synchronisation: The Heartbeat reply contains the current time (currentTime), which the charger can use to correct its clock.
  3. Keeping the connection alive: Some mobile operators and network devices close connections that stay silent for a long time; regular traffic prevents this.

The request and reply look like this:

[2, "2001", "Heartbeat", {}] [3, "2001", {"currentTime": "2026-10-02T10:15:00Z"}]

Where does HeartbeatInterval come from?

The interval is sent to the charger in the interval field of the BootNotification reply. In OCPP 1.6J it can also be changed with the HeartbeatInterval key in the charger configuration (ChangeConfiguration). In OCPP 2.0.1 and 2.1 the same setting is the OCPPCommCtrlr.HeartbeatInterval variable in the device model and is changed with SetVariables.

An important detail: in OCPP 1.6J, a charger may skip a Heartbeat if it has sent another message since the last one, because any message already shows the charger is alive. That is why Heartbeats may become less frequent during charging.

How many seconds should it be?

There is no single right value; it depends on your needs and the type of connection. Practical ranges:

  • 60–300 seconds: A common choice for public chargers whose status must be watched closely. Connection drops are noticed within a few minutes.
  • 300–900 seconds: Sufficient for private car parks, residential sites and workplaces.
  • Over 900 seconds: When data usage must be minimised, but fault detection is delayed.

Remember that messages other than Heartbeat (status changes, meter values) also generate traffic. Making Heartbeat too frequent usually wastes data; making it too sparse may mean you do not notice a disconnected charger for hours.

How it differs from WebSocket ping

In OCPP-J the WebSocket protocol also has its own ping/pong mechanism. In OCPP 1.6J its interval is set with the WebSocketPingInterval key. Ping/pong keeps the connection open at network level; Heartbeat tells you at application level that the charger is working. One does not replace the other. In a good setup the WebSocket ping can be more frequent (for example 30–60 seconds) and Heartbeat less frequent.

What if Heartbeats stop?

If the CSMS receives no messages for several times the expected interval, it should treat the charger as offline. The usual causes are:

  • Internet connection or SIM card problems,
  • A power cut at the charger,
  • Frozen firmware,
  • The connection being closed on the server side.

For a detailed checklist, see our article on why OCPP connections drop.

Data calculation on mobile lines

A Heartbeat message and its reply, together with WebSocket and TLS overhead, take roughly a few hundred bytes. At a 60-second interval a charger sends 1,440 Heartbeats a day, which adds up to a few megabytes a month. That looks small on its own, but it makes a difference across a network of hundreds of chargers and on M2M lines with tight quotas. Moving to 300 seconds cuts this usage to a fifth. Most data usage actually comes from the MeterValues sampling interval, so the two settings should be considered together. See our article on MeterValueSampleInterval for details.

A recommended starting point: for public chargers, Heartbeat at 300 seconds, WebSocket ping at 60 seconds and an offline alert after 15 minutes. After watching your network's behaviour for a few weeks, you can tune these values to your needs.

Monitoring in the dashboard

Rather than watching Heartbeat alone, it is more accurate to watch the "last message time". Üreticy's OCPP software shows each charger's last communication time and raises an alert in the dashboard when the connection drops. The delay before these alerts fire should be consistent with your Heartbeat interval.

Conclusion

Heartbeat is a simple but critical message: it shows the charger is alive, corrects the clock and keeps the connection open. A few minutes is suitable for public chargers and longer intervals for private use. When choosing the interval, balance data cost against fault detection speed.