Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request -> SMA solar Inverter Data via SBFSpot #335

Closed
leader21 opened this issue Oct 23, 2014 · 10 comments
Closed

Request -> SMA solar Inverter Data via SBFSpot #335

leader21 opened this issue Oct 23, 2014 · 10 comments

Comments

@leader21
Copy link
Contributor

Wondering if there are any photovoltaic owners out there using pimatic?
I just installed SBFSpot. This is a program to collect datas about the power output from SMA photovoltaic inverters and stores these in a sqlite or mysql database.
Maybe this could be useful to monitor your photovoltaic facility with pimatic.
here is the homepage of the script : https://sbfspot.codeplex.com/

the output created via comandline parameters is something like that :
http://pastebin.com/evsQgqgN

there's no productivity data (AC and DC spot data) at the moment since it's dark outside ^^
I can provide some other output or the sql database or more if pimatic would benefit from and somebody is able to adopt this feature since i'm no coder ...

The very useful thing about this could be (if it works) to setup a rule that triggers a switch/remote power plug at a certain powerlevel of the inverter. this can save lots of money since the machines that use lots of power could be switched on when there's enough energy delivered from the solar inverter.
lets say your washing machine is connected to a switch device. so now you're filling up your washing machine and set up a rule like IF $ACpowerlevel is > 2000 THEN switch on washing-machine
This should switch your washing machine when there are 2000 watts delivered from the inverter.
Actually this can be done by a very expensive device from SMA called "Sunny Home Manager". This costs about 500 Euro with two remote power plugs :(

What do you think about that? I suggest this is a job for pimatic :)

@leader21
Copy link
Contributor Author

here's an output with some more data with all production informations from the past 10 month that comes directly from the solar inverter. the commandline parameter -am is requesting the production data of the past X months (for a detailed day output for the past X days you can use -ad for detailed day data)
http://pastebin.com/gGgaE3cU
here you can see the actual ac/dc production data (which had been 0.00 yesterday evening due to no sunshine)

DC Spot Data:
        String 1 Pdc:   6.315kW - Udc: 520.76V - Idc: 12.127A
        String 2 Pdc:   2.818kW - Udc: 465.10V - Idc:  6.059A
SUSyID: 128 - SN: 2110XXXXXX
AC Spot Data:
        Phase 1 Pac :   2.964kW - Uac: 228.81V - Iac: 13.273A
        Phase 2 Pac :   2.951kW - Uac: 228.24V - Iac: 13.242A
        Phase 3 Pac :   2.955kW - Uac: 228.30V - Iac: 13.259A
        Total Pac   :   8.870kW

the Total Pac is the energy that is acutally produced by the solar facility. so here i'm having approx. 9Kw/h which is surely enough to power a washing machine, dishwasher and other devices alltogether.
maybe it's also possible to collect all data and display it in a graph or readout the sql database of sbfspot to visualize the power production

The data can also be exported to a csv file

@leader21 leader21 reopened this Oct 24, 2014
@andig
Copy link
Contributor

andig commented Oct 25, 2014

@leader21 I'm using cron to log sbfspot to volkszaehler.org. Using the volkszaehler-pimatic bridge (https://github.com/andig/pimatic-volkszaehler) I've integrated this with pimatic. If you see pimatic on the automation side you could see volkszaehler on the data collection side imho.

I guess you could also cron to pimatic /api/device/... directly.

@leader21
Copy link
Contributor Author

👍
thanks a lot for that hint andig! i'll have a look at the volkszaehler plugin (btw - i just mailed to udo to get a IR D0 reader for my electricity meter and hope to get this thing to work ;)

at the moment i'm trying to set up the pimatic-log-reager plugin to readout the output of SBFspot and create a variable like $pvcurent for the actual pv-output (Total Pac). if this works,i hope i'm having all i wanted for now. Then i could switch some power plug when $pvcurrent has a value of let's say 2000 watt by rule. but unfortunately i fail :(

maybe there is somebody that could give me the missing link...

from the above output (have a look two posts upwards) i need the value of Total Pac(in this example it would be 8.870) as a variable.
I do only get the value of 0.

here's my logreader config :

   {
      "id": "pv-current-from-logfile",
      "name": "PV-Current",
      "class": "LogWatcher",
      "file": "/home/pi/sbfspot.log",
      "attributes": [
       {
          "name": "ACOut",
          "type": "number",
          "unit": "kW"
      }
    ],
        "lines": [
        {
          "match": "Total Pac :",
          "PV-Current": "$pvcurrent"
        }
     ]
   },

where's my mistake?!
question would be how often $pvcurrent will be updated via pimatic ?

@andig
Copy link
Contributor

andig commented Oct 26, 2014

@leader21 I've not used logreader yet. Another approach would be using shell-execute. For an idea look at my Raspi examples added here: https://github.com/pimatic/pimatic-shell-execute

@sweetpi
Copy link
Contributor

sweetpi commented Oct 26, 2014

here's my logreader config :

You need to supply a regular expression to match the value. Give this a try:

   {
      "id": "pv-current-from-logfile",
      "name": "PV-Current",
      "class": "LogWatcher",
      "file": "/home/pi/sbfspot.log",
      "attributes": [
       {
          "name": "acout",
          "type": "number",
          "unit": "kW"
      }
    ],
        "lines": [
        {
          "match": "\s*Total Pac\s*:\s*([0-9]+\.[0-9]+)kW",
          "acout": "$1"
        }
     ]
   },

It should be updated, every time it is logged.

@leader21
Copy link
Contributor Author

I have solved my little problem with the shellsensor as andig proposed.
pvout

    {
      "id": "pvcurrent",
      "name": "Photovoltaik Output",
      "class": "ShellSensor",
      "attributeName": "pvcurrent",
      "attributeType": "number",
      "attributeUnit": "Watt",
      "command": "/usr/local/bin/sbfspot.3/SBFspot -v -nocsv -finq | grep Total -w | sed -e 's/[^1234567890]//g'",
      "interval": 600000
    },    

First i'll get the stdout from SBFspot, grep "Total" and sed it to numbers only.
This command has the disadvantage that i'm only able to readout one value like Total Pac.
But for the purpose of getting a switchable variable this is a simple way and i can set the interval time of updating the variable in pimatic. I'll create another shellsensor for the total daily output EToday just to have an overview.

But Oliver, I tried your log-reader example with "match": "\s_Total Pac\s_:\s*([0-9]+.[0-9]+)kW" but got an error (have a look below). Whats wrong there? Any ideas?
fehler pv1

@sweetpi
Copy link
Contributor

sweetpi commented Oct 26, 2014

Ups, did forget that you have to escape the backslash in json:

 "match": "\\s*Total Pac\\s*:\\s*([0-9]+\\.[0-9]+)kW",

@leader21
Copy link
Contributor Author

sorry to bother again :(
tried again your new match code, the error has gone but the value of the variable is 0 but mylog says Total Pac : 1.2345kW . somehow i guess the log-reader needs some more improvement. sure, you're having lots of work to do - but maybe sometime there could be some kind of gui to set the searchdata for logfiles since this seems to be tricky at all (at least for me as noob ;)

@leader21
Copy link
Contributor Author

Oliver, all's good! The cron job should update the logfile every 10 minutes. I messed up in the crontab and did the update every 10 hours (stupid me ...)
your match code works certainly perfect!!
Will post my config soon whan i am ready. maybe somebody else can benefit of it.

@leader21
Copy link
Contributor Author

Here we go! At last i made it so far ...
I created an array to have the data alltogether :

pv-monitor

now i can use rules for switching devices like dishwasher or washing machine etc. when there's enough power produced from the intverter.

here's my logreader device at the config.json

    {
      "id": "pvlog",
      "name": "Photovolatik Energiemonitor",
      "class": "LogWatcher",
      "file": "/home/pi/sbfspot.log",
      "attributes": [
        {
          "name": "acout",
          "type": "number",
          "unit": "kW"
        },
        {
          "name": "actoday",
          "type": "number",
          "unit": "kWh"
        },
        {
          "name": "actotal",
          "type": "number",
          "unit": "kWh"
        },      
      ],
        "lines": [
        {
          "match": "\\s*Total Pac\\s*:\\s*([0-9]+\\.[0-9]+)kW",
          "acout": "$1"
        },
        {
          "match": "\\s*EToday\\s*:\\s*([0-9]+\\.[0-9]+)kWh",
          "actoday": "$1"
        },
        {
          "match": "\\s*ETotal\\s*:\\s*([0-9]+\\.[0-9]+)kWh",
          "actotal": "$1"
        }
     ]
    },

Also I used the ping-plugin to visualize the network status of the SMA inverter.
all works well so far. the only thing missing is the monthly output. this is too difficult to integrate for me, since the the monthly output looks like that : http://pastebin.com/ci6KL2M0
ArchiveMonthData() and ArchiveDayData() must be added up somehow.

@leader21 leader21 closed this as completed Nov 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants