Skip to main content

Methods

MethodAPI callReturns
publish(station)PUT /api/v1/station{ state }
updatePoints(points)PATCH /api/v1/station/points{ state }
heartbeat()POST /api/v1/station/heartbeatnothing
get()GET /api/v1/stationstored data + state
startHeartbeat(options?)heartbeat() every intervalMs (default 5 minutes)a stop function

publish replaces everything goodcharge knows about the station. updatePoints changes only the listed points; a point's position is its index in charging_points plus one.

startHeartbeat never throws once started, and never rejects: a failed beat is reported to onError (if given) instead, and a throwing onError is itself ignored, so a broken handler can't crash your process. An out-of-range intervalMs still throws invalid_option synchronously when you call startHeartbeat, before the first beat is scheduled. Call the returned function to stop.