Extracting data from APSystems inverters

Rukmal Fernando
2 min readFeb 16, 2019

--

If you have a solar photovoltaic system backed by an APSystems microinverter and you want to extract data directly from it, we can do it easily with curl.

Here’s the curlcommand:

curl -H "Content-Type: application/x-www-form-urlencoded" http://api.apsystemsema.com:8073/apsema/v1/ecu/getPowerInfo -d ecuId=<ECU ID> -d filter=power -d date=<date> -o <date>.json

Before doing this though, we need to find the ECU ID, and the easiest way is to login to the APSystems EMA app, where we can find all the ECU ID’s in the Modules section. The date parameter’s format is yyyymmdd, and I chose to output the response to a .json file with the date as the filename — it helps later.

The response is a JSON object with a data member that in turn has two JSON arrays, time and power. We can easily convert this to a CSV file. Here’s a small Node.js app that does this:

and we can use it this way:

node json2csv 20190101.json > 20190101.csv

And there we have it!

By having the date map to the filename, we can easily generate the curl and json2csv commands for a large number of dates (the power of spreadsheets!). We can also modify json2csv to extract the date from filename and write that as the first of a CSV value triplet, and then append the output of json2csv for multiple .json files into a single CSV file if we want to analyze trends etc.

This by itself is still a bit boring. I’ve been playing around with a solution that can generate daily summaries and alerts and I plan to write about that very soon ;-)

p.s.: it’s a tiny bit scary that APSystems’ API reveals this information so easily. For what it’s worth though, the endpoint that provides personally identifying information appears to be password protected.

p.p.s: shout out to Simple Engineering, the guys who did my installation :-)

--

--

Rukmal Fernando

I used to break thrings apart to see how they worked. Now I try to put things together.