I´ve got openhab running and intergration of my heatpump, as well as sonos are working fine so far.
Next step is to intergrate my SMA inverter to openhab.
I´ve the following configuration:
SUNNY TRIPOWER 9000TL-20
SUNNY HOME MANAGER
What is the best approach to get data from my inverter to openhab?
I use sbfspot (https://sbfspot.codeplex.com/) together with the following rule which reads the last line of the csv file and uploads to pvoutput. Not very elegant but it works.
rule "PV uitlezen"
when
Time cron "0 0/5 5-23 * * ?"
then
executeCommandLine("/home/pi/SBFspot/SBFspot.sh > /dev/null")
var String PVd = String::format( "%1$tY%1$tm%1$td", new Date() )
var String PVt = String::format( "%1$tH:%1$tM", new Date() )
var String smaspotlogfile = String::format( "/home/pi/smadata/%1$tY/ni-lo-pv-Spot-%1$tY%1$tm%1$td.csv", new Date() )
val fileReader = new java.io.FileReader(smaspotlogfile)
var String line
var String nextline
try {
val values = new java.io.BufferedReader(fileReader)
nextline = values.readLine
while (nextline != null) {
line = nextline
nextline = values.readLine
}
}
finally {
try { fileReader.close() } catch (Exception e) {}
}
var String[] pvbuffer = line.replace(",",".").split(";")
postUpdate (PVPac1, Float::parseFloat(pvbuffer.get(10)))
postUpdate (PVIac1, Float::parseFloat(pvbuffer.get(13)))
postUpdate (PVUac1, Float::parseFloat(pvbuffer.get(16)))
postUpdate (PVEtoday, Float::parseFloat(pvbuffer.get(22)))
postUpdate (PVEtotal, Float::parseFloat(pvbuffer.get(23)))
postUpdate (PVFreq, Float::parseFloat(pvbuffer.get(24)))
postUpdate (PVPdc1, Float::parseFloat(pvbuffer.get(4)))
postUpdate (PVIdc1, Float::parseFloat(pvbuffer.get(6)))
postUpdate (PVUdc1, Float::parseFloat(pvbuffer.get(8)))
postUpdate (PVPdc2, Float::parseFloat(pvbuffer.get(5)))
postUpdate (PVIdc2, Float::parseFloat(pvbuffer.get(7)))
postUpdate (PVUdc2, Float::parseFloat(pvbuffer.get(9)))
postUpdate (PVConditie, pvbuffer.get(28))
postUpdate (PVTemp, Float::parseFloat(pvbuffer.get(30)))
var String v1 = (PVEtoday.state as DecimalType * 1000).intValue().toString
var String v2 = (PVPac1.state as DecimalType).intValue().toString
var String v5 = String::format("%.1f", (PVTemp.state as DecimalType).floatValue())
var String PVOutputGET = "http://pvoutput.org/service/r2/addstatus.jsp?key=xxxxx&sid=xxxxx&d=" + PVd + "&t=" + PVt + "&v1=" + v1 + "&v2=" + v2 + "&v5=" + v5
logInfo("PV-GET",PVOutputGET)
sendHttpGetRequest(PVOutputGET)
end
I discoverd, that sunnyportal is providing real data from my inverter as well as my power meter in that format:
{"__type":“LiveDataUI”,“Timestamp”:{"__type":“DateTime”,“DateTime”:“2015-11-02T10:51:15”,“Kind”:“Unspecified”},“PV”:4696,“FeedIn”:4378,“GridConsumption”:0,“DirectConsumption”:null,“SelfConsumption”:318,“SelfSupply”:318,“TotalConsumption”:318,“DirectConsumptionQuote”:null,“SelfConsumptionQuote”:7,“AutarkyQuote”:100,“BatteryIn”:null,“BatteryOut”:null,“BatteryChargeStatus”:null,“OperationHealth”:null,“BatteryStateOfHealth”:null,“InfoMessages”:[],“WarningMessages”:[],“ErrorMessages”:[],“Info”:{}}
Same situation here! Ich also discovered the json data by sniffing my fritzbox.
I want to switch my heatpump between normal circuit and heatpump circuit depending in power situation from my solar system.
Problem: let’s call me a DAU in regards to programming - I have no clue about automatically logging in and pulling/saving data locally for switching.
Integration into openhab sounds very interesting to me! Any progress so far? I just saw that SMA now supports modbus as well.
Hallo Jens,
the SEMP protocoll does not deliver any live datas. It connects the SMA Home Manager with other electrical machines e.g. like washing machine to control the switch on/off depending on the power of the pv modules.
I use it on my windows server (it only runs there) I have a script (found on some other posts) that extract a CSV file and then I upload it on my zonphp website (http://zonphp.cindyenguy.be/)
Now, as I have SBFSpot on my rasp, it’s easier to get it all done from a central location
Okay… The reason I ask is because a seek a solution for our SMA solar setup:
Sunny Tripower 6000TL
Sunnyboy Storage 2.5
SMA Energy Meter.
LG chem Resu 10 (10kWh lithium battery).
There is a binding for the Energy Meter, but I cant use it because the Energy Meter is connected directly to the Sunnyboy 2.5, running speedwire inbetween, which means I can´t reach the Energy Meter on my LAN. (I have tried connecting the Energy Meter to my main switch, but that resolved in the Sunnyboy wont see the Energy Meter, leaving me without data update on Sunny Portal). It should have been working, but isn´t for some reason.
So I am searching for an alternative way to collect the data, either from Sunny Portal og Sunny Explorer.
I needed to use the current power from the SunnyBoy to be used and diplayed in OpenHab2. This for switching the electro car charger on and off, depending on the power from the solar panels.
For this purpose I installed a headless webscraper on the OpenHabian Pi, made a Python script to get the values from sunnyPortal.com and send the current values to OpenHab2 by the mqtt binding. With an alogorithm using the current value and the average of the last 5 minutes I switch the charger on and off.
The average of the last 5 minutes is easily calculated thanks to the persistence functions of OpenHab.
The Python script needs a lot of error handling to get the input stream stable, but it finally seems to work so far.
I have a similar configuration. Tripower 9000, Boy Storage 5.0 and Home Manager 2.0. The best way to collect data is with modbus. OpenHab is able to comunicate directly with these devices. I wanted to write a binding for that but we don’t need that. Here are my configuration files for modbus. Maybe you can use some stuff from it.
The list of modbus registers is availible from the SMA website. You have to enable modbus on the tripower and on the boy storage and activate the modbus binding.
I already have modbus running for my Nilan ventilation system…
I think I´ll try with the Smart Energy meter binding again. I have spoken to a few people, and they said it should work, if I insert the energy meter and the Sunnyboy storage 2.5 directly into my switch. And then reset the Energy Meter (<-- important step).
After that Sunnyboy storage should be able to see the energy meter. And openhab will be able to connect to the energy meter as well through the binding. I just need some free time to make the change