Overview
Electricity Maps publishes hourly and sub-hourly data about the electricity on the grid in about 350 zones worldwide: how carbon-intensive it is, which sources produce it, what it costs on the day-ahead market, and forecasts of all of these. The API v4 (https://api.electricitymaps.com/v4) is documented at app.electricitymaps.com/docs.
The ElectricityMapsApi connector maps 35 MQTT topics onto that API, all read-only GET calls. Typical uses are carbon-aware scheduling (shift flexible loads such as compressors, chillers, EV charging or batch processes into low-carbon or low-price hours), Scope 2 reporting per production line, and showing grid carbon intensity on a plant dashboard next to energy meters. Each event publishes the API reply on <topic>/response.
Authentication
Every request sendsauth-token: {value.json.token}. Keep the API key in a broker secret, for example ELECTRICITY_MAPS_TOKEN, and map it into the payload with GET SECRET. ListZones and GetZone answer without a key, so send token = "" for them. A wrong key on ListZones returns 401 Token is invalid; the data endpoints return 401 Invalid auth-token without a valid key.
Choosing a zone
Passzone=PT (zone keys come from ListZones) or lat= and lon= in query. GetZone turns coordinates into a zone key once, for example lat=41.15&lon=-8.61 returns PT for Porto. Without a zone or coordinates the API falls back to the location of the caller’s IP address, which for a broker in a data center is usually the wrong grid. Add disableCallerLookup=true to turn that fallback off.
Request payload
Every event reads its values from the JSON payload published on the request topic:
Common query parameters are
temporalGranularity (5_minutes, 15_minutes or hourly), emissionFactorType (lifecycle or direct), flowTraced (true for consumption-based values, false for the zone’s own production), disableEstimations, horizonHours for forecasts, datetime for a past point and start plus end for a past range (ISO 8601, UTC). Leave query as "" when an event needs no parameters, which leaves a harmless trailing ? on the URL.
Connector template
ElectricityMapsRestApi.lot.
Example actions
These actions poll Portugal (PT) at about 6 calls per hour. Replace the zone with your own.
Testing
- Store your key: add the secret
ELECTRICITY_MAPS_TOKENon the broker. - Deploy
ElectricityMapsRestApi.lot. - Publish
{"token": "", "query": "lat=41.15&lon=-8.61"}toenergy/electricitymaps/zone/getand check thatenergy/electricitymaps/zone/get/responsereturns"zoneKey":"PT". - Publish
{"token": "<your key>", "query": "zone=PT"}toenergy/electricitymaps/carbon-intensity/latest/getand check that the response carriescarbonIntensityanddatetime.
Notes and limits
- Version: this connector uses v4. The v3 paths still answer, but in v4 the old
power-breakdownendpoints are calledelectricity-mix. - Hourly data changes once an hour. Polling faster only helps with
5_minutesor15_minutesgranularity on plans that include it. GetLmpDayAheadLatestis for US pricing nodes (node=is required);price-day-aheadcovers European zones.- Marginal emission signals were discontinued by Electricity Maps and are not part of this connector.

