Setup guides → Push API
Push API
No adapter for your inverter? Send the readings yourself from a shell script, a Node-RED flow or a cron job.
The endpoint
POST https://api.sunplug.app/ingest/site
Authorization: Bearer <your API key>
Content-Type: application/json
{
"tsms": 1785759034000,
"production_kw": 4.2,
"net_import_kw": -3.1,
"consumption_kw": 1.1,
"battery_discharge_kw": 0.0,
"battery_soc": 0.62
}
Your key is in the app under Settings → Equipment → Send us your own readings.
The fields
The one thing to get right
Export must be negative. Everything balances:
consumption = production + net_import + battery_discharge. With
the grid sign backwards, Sunplug sees a 3 kW import on a sunny afternoon and
will not charge, with no error.
If you measure two of the three, leave the third out; it will be derived. A wrong third value is worse than none. Production alone is refused.
An example
curl -sS -X POST https://api.sunplug.app/ingest/site \
-H "Authorization: Bearer $SUNPLUG_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"tsms\": $(($(date +%s) * 1000)),
\"production_kw\": 4.2,
\"net_import_kw\": -3.1,
\"consumption_kw\": 1.1}"
How often
Every thirty seconds; faster buys nothing. Slower is accepted and shown as less fresh. Duplicates and slightly out-of-order readings are fine.
The data age beside the dashboard's live figures should settle at your sending interval. If it climbs, your posts are failing: the response body names the rejected field.
Coming from ChargeHQ
Field names, units and sign conventions match ChargeHQ. Three things change:
- The address.
api.chargehq.net/api/public/push-solar-databecomesapi.sunplug.app/ingest/site. - The key leaves the body. ChargeHQ takes
apiKeyas a JSON field; Sunplug takes anAuthorization: Bearerheader. - The meters un-nest. No
siteMetersobject; the readings go at the top level.
What you send ChargeHQ:
POST https://api.chargehq.net/api/public/push-solar-data
{
"apiKey": "YOUR-KEY",
"siteMeters": {
"production_kw": 4.2,
"net_import_kw": -3.1,
"consumption_kw": 1.1
}
}
The same reading, sent here:
POST https://api.sunplug.app/ingest/site
Authorization: Bearer YOUR-KEY
{
"production_kw": 4.2,
"net_import_kw": -3.1,
"consumption_kw": 1.1
}
No endpoint accepts ChargeHQ's format unchanged.
Stuck, or would rather have an adapter? Email me.