SBF spot to fetch and upload consumption values

I have installed SBFspot ver3.40 on a Raspi fetching data from a SUNNY BOY 3.6. which is communicating with a Home Manager2.0 (including Energy Meter).
I am uploading Generation Data succesully here - nevertheless I wonder how to upload Consuption data. In SBFspot there is obviously evrything prepared for consumtion upload (looking into the table vwPvoData the fields V1…V6 should be uploaded:
dd.TotalYield AS V1,
dd.Power AS V2,
cons.EnergyUsed AS V3,
cons.PowerUsed AS V4,
spot.Temperature AS V5,
spot.Uac1 AS V6,
Actually there is no Consumtion data at all provided by my Inverter so that the SBFspot.db entries are empty.
And now my question:
How could I change sbfspot bin (/usr/local/bin/sbfspot.3/SBFspot -v -finq -nocsv) to upload also the consumption data from my inverter?

Yes, preparation for consumption upload is done, but I’m waiting for some clever people to finish and test it…
Actually you have to feed the data into the consumption table. This is the first challenge. Upload daemon stops uploading when production stops. This will stop consumption upload too. This is the second challenge.

Ok, understood. Thank you.
I was not sure if it was already integrated since I do not understand the command line switches you are using for sbfspot (-apm, -v …). I hoped it was hidden in there already.

Nevertheless I would volunteer to trial early versions if it helps.
Regards

Sorry to resurrect an old thread but has there been any progress on the ability to upload consumption data from the SAM energy meters? It would be great to get this all working within the same PVoutput as I find the sunny portal not useful when sharing with others to see data. thanks.

SBFspot and readout of EM is not possible ATM.
See https://github.com/SBFspot/SBFspot/issues/50

Again further to this thread is it possible to upload consumption either into SBFspot via another source and or when I tried to upload direct to pvoutput to the same system as what SBFspot uploads to after SBFspot does its upload it replaces all the data my other source uploads. So is it possible to change sbfspot to only upload the solar generation and not replace all the other fields? Thanks. ps I am using home assistant to pull the info from my SMA EM and upload to pvoutput.

I didn´t test this, but you can try to modify the vwPvoData view:
Replace cons.EnergyUsed and cons.PowerUsed with NULL.
Remove the LEFT JOIN with vwAvgConsumption

Thank you for your suggestion. I will give it a try and see how it goes. I have to wait until tomorrow as it is night time here in Australia. I was able to drop the old view. I just copied the suggested code from the wiki page and made your suggested changes. I then just copied all of this text and pasted it into the ssh command which was logged into the sqlite3 database. Is the correct way of creating a new view? Is there a way to check if the view was created successfully? Thanks for your help.

This SQLite command shows the current definition:

.schema vwPvoData

So i can confirm that my new view for vwPvoData worked as i can see my modified view using the command you provided above. However, still in pvoutput any time sbfspot updates with new solar generation data it removes my previous home assistant uploaded consumption data. From what i understand if sbfspot when it adds I assume using the addstatus api https://pvoutput.org/service/r2/addstatus.jsp if it doesnt include the “t” time switch it will replace any existing data for that row of data. Does sbfspot include the t parameter when it addes its data? Any other suggestions of how i can get this to work? Thanks.

SBFspot uses addbatchstatus.jsp and includes the timestamp. I have to investigate what is going on here.

@nihonjin I can’t reproduce your issue.
First I send consumption data (generation fields are empty):

curl -v -H "X-Rate-Limit:1" -H "X-Pvoutput-Apikey:<my_api_key>" -H "X-Pvoutput-SystemId:<my_system_id>" -d "data=20211022,10:00,,,2000,210" https://pvoutput.org/service/r2/addbatchstatus.jsp

After a few minutes I send generation data for the same date/time (consumption fields are empty, temperature and voltage are provided):

curl -v -H "X-Rate-Limit:1" -H "X-Pvoutput-Apikey:<my_api_key>" -H "X-Pvoutput-SystemId:<my_system_id>" -d "data=20211022,10:00,850,1109,,,23.1,240" https://pvoutput.org/service/r2/addbatchstatus.jsp

In PVO, consumption and generation is shown

I am not sure what the specific code is that is used within SBFspot but i followed the install guide and setup the following as per the install wiki:

daydata:

#!/bin/bash
#
log=/var/log/sbfspot.3/DanSolar_$(date '+%Y%m%d').log
/usr/local/bin/sbfspot.3/SBFspot -v -ad1 -am0 -ae1 -mqtt -cfg/usr/local/bin/sbf$
/usr/local/bin/sbfspot.3/SBFspot -v -finq -nocsv -cfgSBFspot_2.cfg -mqtt
/usr/local/bin/sbfspot.3/SBFspot -v -finq -nocsv -cfgSBFspot_1.cfg -mqtt

monthdata:

#!/bin/bash
#
log=/var/log/sbfspot.3/DanSolar_$(date '+%Y%m').log
/usr/local/bin/sbfspot.3/SBFspot -v -sp0 -ad0 -am1 -ae1 -finq -cfg/usr/local/bi$

and then created the following cron job:

## SBFspot
*/5 6-22 * * * /usr/local/bin/sbfspot.3/daydata
55 05 * * * /usr/local/bin/sbfspot.3/monthdata

I then use the following to upload my temperature and power usage separately to SBFspot:

pvoutput_consumption: 'curl -d "d={{now().strftime("%Y%m%d")}}" -d "t={{now().strftime("%H:%M")}}" -d "v4={{states.sensor.home_live_actual_consumption.state|round(0)}}" -H "X-Pvoutput-Apikey: My-API-Key" -H "X-Pvoutput-SystemId: My-Sys-ID" https://pvoutput.org/service/r2/addstatus.jsp'   
pvoutput_temperature: 'curl -d "d={{now().strftime("%Y%m%d")}}" -d "t={{now().strftime("%H:%M")}}" -d "v5={{states.sensor.temp.state|round(1)}}" -H "X-Pvoutput-Apikey: My-API-Key" -H "X-Pvoutput-SystemId: My-Sys-ID" https://pvoutput.org/service/r2/addstatus.jsp'

When i look at the live data for the day I see it upload my temperature and power usage just after the 5min interval mark and then soon after when the solar generation data is uploaded it removes it.


I also notice that when I look at the daily data for previous days it will show only data from when solar is generating and whilst solar is generating there is no temperature and power usage but as soon as solar stops the temperature and power usage starts recording and the data stays.

As you can see in the first image whilst solar is generating i get no temperature or power but as soon as solar stops the temperature and power usage starts storing the values:

Also for some reason it does not show any power or temperature usage before the solar starts which in my area for yesterday was 5:25am. It should be showing temperature and power usage from midnight. Thus my cumulative values are inaccurate for the day as it doesn’t record any power usage before solar or during solar generation.

Really sorry, but I still can’t reproduce your issue.

Can you see what I’m talking about though with my screenshots? Does any of my code look wrong or could be causing my problem? Thanks

Sure I see…
But when I simulate the process on my system it looks perfect
I upload consumption data for 16:10 (V4=1500) around 16:08

curl -d "d=20211031" -d "t=16:10" -d "v4=1500" -H "X-Pvoutput-Apikey:xxx" -H "X-Pvoutput-SystemId:xxx" https://pvoutput.org/service/r2/addstatus.jsp

After that, I let SBFspot and SBFspotUpload do their job and this is the result:

The “Power Used” 1500W at 16:10 is never removed.

Great news. At least for me anyway. I managed to get it to work. Turns out it was a setting in my PVOutput system that was causing the problem. I am not exactly sure which one it was but after I turned off all data aggregation settings it no longer removed the consumption data I uploaded when sbfspot did its upload. It looks like what was happening is when sbspot uploaded it was tyring to combine value for solar, consumption, temperature etc and the effect was it removed them. But now all is working. Thank you SBF for your help and pushing me to try and solve this.

1 Like

If this was a parent system then an upload to one of its children would have overwritten existing data

@SBF Sorry to hijack this thread: According to the release notes of 3.9.0 it should be possible to read energy data (consumption) from SMA energy meters. Does this work out of the box or is some configuration necessary? Is there some documentation on how to configure my SBFspot installation?

Edit: Adding MeteringWIn, MeteringWOut and MeteringWTot to my SBFspot.cfg does work, grid values are published via MQTT. However, nothing is written to the database. Did I miss some configuration?

@ogoroll Please create an issue in SBFspot github project.

1 Like