Batch Status API, consumption and generation

Hi,

I’m trying to figure out how to use the batch status API to add import and export data to my system.

My setup currently uses a custom script to download a day’s worth of live data, a 5 minute intervals, from my inverter, munge the data into the format expected by pvoutput and upload via the batch status API. This works well.

My energy provider, Powershop, provides a CSV that contains import and export on a 30 minute intervals. This seems to be in kWh. I’d like to add this data to my system, but haven’t been able to work out how to achieve this.

This is a sample for from the CSV:

NMI,METER SERIAL NUMBER,CON/GEN,DATE,ESTIMATED?,00:00 - 00:30,00:30 - 01:00,01:00 - 01:30,01:30 - 02:00,02:00 - 02:30,02:30 - 03:00,03:00 - 03:30,03:30 - 04:00,04:00 - 04:30,04:30 - 05:00,05:00 - 05:30,05:30 - 06:00,06:00 - 06:30,06:30 - 07:00,07:00 - 07:30,07:30 - 08:00,08:00 - 08:30,08:30 - 09:00,09:00 - 09:30,09:30 - 10:00,10:00 - 10:30,10:30 - 11:00,11:00 - 11:30,11:30 - 12:00,12:00 - 12:30,12:30 - 13:00,13:00 - 13:30,13:30 - 14:00,14:00 - 14:30,14:30 - 15:00,15:00 - 15:30,15:30 - 16:00,16:00 - 16:30,16:30 - 17:00,17:00 - 17:30,17:30 - 18:00,18:00 - 18:30,18:30 - 19:00,19:00 - 19:30,19:30 - 20:00,20:00 - 20:30,20:30 - 21:00,21:00 - 21:30,21:30 - 22:00,22:00 - 22:30,22:30 - 23:00,23:00 - 23:30,23:30 - 00:00
410XX,217XXXXX,Consumption,24/8/2018,No,0.539,0.212,0.115,0.183,0.248,0.232,0.211,0.188,0.24,0.163,0.146,0.209,0.17,0.194,0.185,0.174,0.206,0.014,0.012,0.0,0.0,0.001,0.0,0.0,0.0,0.0,0.002,0.035,0.183,0.0,0.0,0.001,0.702,0.869,0.736,0.182,1.564,1.612,1.672,1.246,1.094,1.145,0.725,0.637,0.608,0.642,0.64,0.614
410XX,217XXXXX,Generation,24/8/2018,No,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.008,0.004,0.215,0.765,0.845,0.606,0.668,0.885,0.866,0.789,1.735,1.153,1.207,0.251,1.103,0.796,0.376,0.176,0.004,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0

Following the docs about Net upload with the batch status api:

Positive or zero	Positive or zero	v2	v4

I’m sending batches of records that look like this (but for 24hours):

"20180824,10:10,-1,101,-1,0", "20180824,10:15,-1,101,-1,0",
 "20180824,10:20,-1,101,-1,0", "20180824,10:25,-1,101,-1,0",
 "20180824,10:30,-1,111,-1,0", "20180824,10:35,-1,111,-1,0",
 "20180824,10:40,-1,111,-1,0", "20180824,10:45,-1,111,-1,0",
 "20180824,10:50,-1,111,-1,0", "20180824,10:55,-1,111,-1,0",
 "20180824,11:00,-1,147,-1,0", "20180824,11:05,-1,147,-1,0",
 "20180824,11:10,-1,147,-1,0", "20180824,11:15,-1,147,-1,0",
 "20180824,11:20,-1,147,-1,0", "20180824,11:25,-1,147,-1,0",
 "20180824,11:30,-1,144,-1,0", "20180824,11:35,-1,144,-1,0",

My understanding is that the records about show the export of, for example, 144W of power over the 11:25 to 11:30 period. There are corresponding figure for non-daylight hours that show positive import e.g.:

 "20180824,20:10,-1,0,-1,182", "20180824,20:15,-1,0,-1,182",
 "20180824,20:20,-1,0,-1,182", "20180824,20:25,-1,0,-1,182",

These records are accepted by the API but the resulting figures on the site don’t correspond with the totals provided by Powershop.

An example can be seen at https://pvoutput.org/intraday.jsp?id=67310&sid=59922&dt=20180824. The power used seems to mirror the power generated. I would expect the power used to be flat in the middle of the day with peaks in the morning and evening.

I’m not sure if I’m sending incorrect data or have a misunderstanding about how to upload the consumption and generation data. Any help greatly appreciated.

regards,

Martin

To send net data (import/export) instead of gross add n=1 parameter to the request.

I’m sending my params as

    "data=#{data}&n=1&delay=1"

where data is the concatenated string of statuses.

The data param is being picked up ok, so I don’t see why the n=1 wouldn’t?

thanks

Make a request through web browser, this should process the n=1

The delay parameter is not applicable for Add Batch Status.

Sorry to revive an old thread, but did you ever get this working @martinstannard?

I only recently discovered the “net” feature was added to the batch status API, and was trying to do the same - amend my solar production data with consumption/generation data from Powershop to get a fuller picture (albeit a day later).

I think I might be a bit confused between energy (kWh) and power (W). Powershop reports the half hour data in kWh - so presumably if they say you used 0.997 kWh of electricity between 10:00 and 10:30am, that corresponds to 1,994W during that period (i.e. you need to double the kWh figure because it’s only over half an hour).

So I’ve got a script that’ll upload “Import” figures of 332W for the six 5 minute blocks of that half hour to spread that 1,994W out, and same for generation (i.e. export as far as Powershop is concerned).

However the resulting data doesn’t seem to add up… it seems correct for the periods with no solar generation, however when I have the 5 minute production data from the inverter it doesn’t seem right. The total “energy used” at the end of the day is almost 50% less than the total kWh Powershop reports for “consumption”. Here’s the one day I’ve been experimenting with: https://pvoutput.org/intraday.jsp?id=62484&sid=84564&dt=20210619&gs=0&m=0

Am I making some bad assumptions that mean PVOutput’s net calculations don’t end up working right? I have a feeling that trying to spread a 30 minute value over 5 minute periods might be where things go wrong because the import/export data doesn’t always line up with the consumption data which is more accurate.

Maybe I just need to get a smart meter installed and get the real data in 5 minute intervals same as from the inverter instead of trying to munge the Powershop data!

EDIT: I found this post from the “suggested posts” list. I realise what I was doing wrong, I shouldn’t be “spreading” that 1,994W out, but rather to get 997Wh over 30 minutes you need 1,994W over that whole period - makes sense now that I think about it, 1,994W for half an hour is 1.994kW(half-hour) which is 0.997kWh.

I adjusted my script and it seems to be more correct now - with the caveat that the import / export data doesn’t have the same granularity so might be slightly off.

This will always be a problem when 30 minute data is averaged over shorter periods, the net calculation will never be correct.