Heartbeat

Core CP->CSMS

Sent periodically by the Charge Point to notify the Central System that it is still alive.

Quick Reference

This message has an empty payload:

Example Payload

{}

Example Full Frame

[
  2,
  "msg-001",
  "Heartbeat",
  {}
]

Format: [MessageType, MessageId, Action, Payload]

Overview

The Heartbeat message is a simple keep-alive mechanism. The Charge Point sends it periodically to let the Central System know it’s online and operational. This is the simplest OCPP message with an empty payload.

When to Send

  • At the interval specified in the BootNotification response
  • Default interval if not specified: typically 300 seconds (5 minutes)
  • Can be adjusted via ChangeConfiguration for the HeartbeatInterval key

Expected Response

The CSMS responds with:

  • currentTime: The current time at the CSMS (for clock synchronization)

Usage Notes

  • The payload is always an empty object {}
  • This is the primary mechanism for keeping the WebSocket connection alive
  • Also serves as a clock synchronization mechanism
  • Missing heartbeats can trigger connection timeout on the CSMS side

Best Practices

  1. Configure appropriate interval - Too frequent wastes bandwidth; too infrequent may cause timeouts (300s is typical)
  2. Sync clocks - Update Charge Point time using the currentTime from each response
  3. Monitor failures - Multiple failed heartbeats may indicate network issues
  4. WebSocket ping/pong - Some implementations also use WebSocket-level ping/pong frames alongside Heartbeat

Testing Tips

  • Test with empty payload {} to verify basic acceptance
  • Test clock drift by comparing sent time vs. response currentTime
  • Test connection recovery after missing several heartbeats
  • Verify configurable interval via ChangeConfiguration

Common Errors

NotImplemented

Cause: CSMS doesn't support Heartbeat (rare)

Solution: Verify CSMS OCPP 1.6J compliance

InternalError

Cause: CSMS processing error

Solution: Check CSMS logs and retry