Before you start
You’ll need an API key, and the ID of the location the pylon serves. Both figures come from that location: its EVSEs carry their status, and their connectors carry the tariff that sets the price.Show the current price
1
Fetch the location and find its tariff
Fetch the site by ID. Each EVSE’s connectors carry
tariffIds — the currently valid tariffs for that connector.2
Fetch the tariff and read the price
Fetch the tariff by that ID:The price per kWh is the
price on the price component of type ENERGY; the currency sits on the tariff. The price is exclusive of VAT — apply the component’s vat if the pylon shows a consumer-facing, VAT-inclusive figure.A tariff can hold more than one element, each with its own
restrictions (time of day, day of week, date range). Elements are evaluated top to bottom, and the first whose restrictions match applies — so to show the current price, pick the first element whose restrictions are satisfied right now, then read its ENERGY component. A tariff with a single, unrestricted element has one price. The structure follows OCPI 2.1.1.Show charger availability
Fetch the same location and count the EVSEs whosestatus is AVAILABLE — that’s the number of free charging spots.
status on each EVSE is an OCPI value — AVAILABLE, CHARGING, BLOCKED, OUTOFORDER, and so on — so a simple count of AVAILABLE EVSEs gives the free-spot figure for the display.
Keep it current
- Poll on a sensible interval and stay within the rate limit of 120 requests per minute — availability changes far faster than price, so you can refresh it more often.
- Evaluate tariff restrictions in local time, so time-of-day pricing flips at the right moment on the display.
- Fail gracefully. If a request errors, keep showing the last known values rather than blanking the pylon, and retry with backoff. See Errors.
Related
Locations
The site, its EVSEs, and their connectors and status.
EVSEs
EVSE status values and what they mean.