Binding Request: SMA Sunny home manager using sunnyportal.com

Would you agree to share all your config ?

At the moment I use sunnyexplorer to extract my SMA data and upload on a website (mysql) to display the usage, …

I have now installed SBFSpot on my Rasb and this looks promising. I’d like to grab your config to see what are the different graphs posibilities

Thank

How do you use Sunny Explorer?

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.

Hi,

Just another way of getting this done.

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.

For webscraping see: http://www.mantonel.com/tutorials/web-scraping-raspberry-pi-and-python

Adressing the “currentPower” in the webbrowser:

divElement = browser.find_element_by_xpath(’//div[@data-name=“pvPower”]’)
SubHead = divElement.find_element_by_xpath(’.//div[@class=“widgetSubHead”]’).text
currentPower = divElement.find_element_by_xpath(’.//span[@class=“mainValueAmount”]’).text

Nb. you will need the SubHead info to, if it is not null, the currentPower is old info.

If anyone is interested in more info, let me know.

Good luck !

1 Like

Hi,

I wrote a SEMP service for OpenHab, You can test it if you like.
SEMP Service

Greetings
Markinus

1 Like

Hi,

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.

Modbus SMA.zip.txt (6.1 KB)

(it’s a zip file, remove the .txt from filename).
Greetings
Markus

3 Likes

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 :slight_smile:

This looks awesome, thank you.
I’m getting my PV with SMA Tripower and SunnyHomeManager installed end of february. Looking forward…

How do you store the data in openhab? Kind of database?

Hi,

yes, there ist the RRD4j persistance. This holds the data in backround and send it e.g. to cometvisu.

Markus

1 Like

Hello OpenHab community,

I just started to use OpenHab and to integrate all the different things. I also have a SMA Sunny Tripower and A Sunny Home Manager, which transfers all the data about produced and consumed energy to https://www.sunnyportal.com/.

I didn’t find any recent information / integration of that setup into OpenHab - is there any?

In other forums, I found the link to an internal (but pretty neat) API (https://www.sunnyportal.com/homemanager) - which provides all the data I like to have:

Example:

{"__type":"LiveDataUI","Timestamp":{"__type":"DateTime","DateTime":"2021-05-03T13:38:38","Kind":"Unspecified"},"TimestampUtc":{"__type":"DateTime","DateTime":"2021-05-03T11:38:38","Kind":"Utc"},"PV":6859,"FeedIn":6499,"GridConsumption":0,"DirectConsumption":null,"SelfConsumption":360,"SelfSupply":360,"TotalConsumption":360,"DirectConsumptionQuote":null,"SelfConsumptionQuote":5,"AutarkyQuote":100,"BatteryIn":null,"BatteryOut":null,"BatteryChargeStatus":null,"OperationHealth":null,"BatteryStateOfHealth":null,"ModuleTemperature":null,"EnvironmentTemperature":null,"WindSpeed":null,"Insolation":null,"BatteryMode":null,"InfoMessages":[],"WarningMessages":[],"ErrorMessages":[],"Info":{}}

Would it be a recommended way to import produced / consumed data from there? Is the HTTP binding an appropriate way to do so?

Thank you guys in advance,
Daniel

I personally would not rely on a third party service when everything you need is present in your local network.
Like written above from others use the modbus binding with specific registers defined by your devices (can be found on the sma website) directly @OH. Another option is GitHub - datenschuft/SMA-EM: SMA Energymeter measurement - pretty nice for getting the modbus data via mqtt - which I am currently using as prod.

I know your this is an old thread but thanks for sharing your SMA config. Could need a bit assistance with that. I have a Tripower 10 which uses a lot of the same registers. However I am having trouble getting this to work with OH3. No matter what IP I put in it always displays as “online”. What IP are you using? I connect to the web config (LAN) by 192.168.178.66, Speedwire is 192.168.0.170 and WiFi 192.168.0.173. So I set it to the 66 and 502/3, same config as yours. Once I put the files in the correct paths I get a long list of TP_things, the tripower thing got no channels so I assume I have to get that from the TP_ things? They don´t seem to get any data, any chance to validate the connection to the Tripower?

Hi,
the configuration is still the same. You need the LAN IP.
If you add the thing file than you should see a lot of new things in the openhab configuration. If these things are online than the communication works. But this is only the getting of the data.
In second step you need the items. If you add this item file than the items sould appear in the openhab configuration.

1 Like

I did check with the RMMS tool if the modbus thing is working and I was able to connect and fetch some data with that. Anyway, back to OpenHAB for example with TP_30537_2 “Tagesertrag” if I go to channels it remains “NULL”. So it looks to me like there is no connection.
What exactly to the other numbers in the config?
Number TPTagesertrag “Tagesertrag [%d kWh]” (gPV) { channel=" modbus:data:tripower:input_30529_72:30537_2:number" }

I understood 30529 is the register but what is _72 and _2 doing?
In the RMMS test tool I get 10 values as a result (probably due to the length 10) +1 and +7 are increasing, so probably the current “Ertrag” (*wir könnten das auch in Deutsch machen aber ich will hier das Forum nicht sabotieren :wink: )

What does your openhab.log have to say about modbus?

“tripower” as used here is some arbitrary name that you gave to some TCP or Serial modbus Bridge Thing. The “owning” Thing, if you like.

“input_30529_72” is some arbitrary name that you gave to some modbus poller Thing.
Maybe you’ve chosen to use a convention, at a guess the “input” part represents the modbus register type, “30529” the base register address, “72” the block length?

“30537_2” is some arbitrary name that you gave to some modbus data Thing.
Maybe you’ve chosen to use a convention, at a guess the “30537” part represents a register address, maybe the “2” is because it’s a two-register 32-bit value.

There’s no magic here; it just needs to match Things and channels that you configured and chose your own names for. Yes, I realise you copy-pasted really, but these are just names to match up.

Show us the settings you used there.

1 Like

Yes, this is exactly how I set the names. So you can always see which register is read.
The bridge:

Bridge poller input_30529_72 "TP_Input_30529_72" [ start=30529, length=72, refresh=2000, type="input" ]

polls the data from the device. It starts with register 30529 and it’s reading 72 16-bit words every 2 seconds. There is a limit on the SMA devices how meny registers you can read at once, it is in the documentation. This is the reason why there is a lot of bridges.

The thing inside if this bridge:

Thing data 30529_2 "TP_30529_2" [ readStart="30529", readValueType="uint32"]

Reads reads from this recived data the register 30529 a “uint32”, this is a 2 16-bit words value and saves this inside of 30529_2.

The Item is the interface to this thing, it is referencing to the bridge input_30529_72 and thing 30529_2 , like above.

Number TestValue "Test [%d W]"   { channel="modbus:data:boystorage:input_30529_72 :30529_2 :number" }

Edit: Typo: Changed Byte into 16-bit words

1 Like

72 16-bit words to be pedantic, but that’s the principle yes.

1 Like

Oh, yes, you’re right, I was to fast… fixed.

1 Like

Okay understood.
The settings I used wit RMMS:
Device ID : 3
Holding registers
Address 30529
Length 10 (2 works too)
Display Options: Decimal