SMA EnergyMeter 4x

Hmm, that’s way out of my league I’m affraid :frowning:

Hi @monnimeter

I just managed to install your binding, but nothings showing ? it detects the sma em itsself, but nothing else, am I missing anything here ?

I see it under configuration, things, i see my serialnumber there, but no data or whatsoever ?

what I wanted to see was if I could use that data to store it in an influxdb ? and afterwards make is visible with grafana ?

Hi @broke23 ,

did you add some items and link them to the things channel?

Here’s an examle:

Number	PV_Power_In		"Bezogene Leistung"		<energy>		(PV)	{ channel = "smaenergymeter:energymeter:1900234600:powerIn" }
Number	PV_Power_Out	"Eingespeiste Leistung"	<energy>		(PV)	{ channel = "smaenergymeter:energymeter:1900234600:powerOut" }
Number	PV_Energy_In	"Bezogene Energie"		<energy>		(PV)	{ channel = "smaenergymeter:energymeter:1900234600:energyIn" }
Number	PV_Energy_Out	"Eingespeise Energie"	<energy>		(PV)	{ channel = "smaenergymeter:energymeter:1900234600:energyOut" }

You should replace the number 1900234600 with the serial number of your energy meter (it also shows in the Paper UI).

Give it a try :slight_smile:

Regards,
Osman

Thanks for the answer @monnimeter

Serial was there :slightly_smiling_face:

but seems i had to click on the big O infront of each line, now it’s showing … :slight_smile: didn’t know that (stupid me)

now that I have that available.

trending_upPurchased energy
trending_upGrid feed-in energy

do the 2 above come from the time the em started monitoring ?

is this writing away data anywhere ? or can I set this up myself ?
and can we add more things (reference http://www.eb-systeme.de/?page_id=1240)

already big thanks for this addon!!!

Hello Mr. Basha,

Nice greetings from Kassel!
I’m using your openHAB2 SMA EnergyMeter binding as well and my question do you plan to support more outputs in near future?
For example the daily In/Output Power

Best regards,
Korty

@monnimeter I have as well a setup with 2 energy meters and tried to define both in the thing-file. But finally it does not work.

The binding just discovers one meter and no matter what I do, the things are connected to the discovered one:

image

The items then jump between the two meters according interval-setting. In other words the binding can measure from this two meters but cannot split the values to different items (serial numbers)

Any ideas how I can solve this?

Thanks
Michael

1 Like

I have the same problem.
Is there already a solution.

br
Maik

I have a solution that works for me.
In one smart meter, I change the destination address to 239.12.255.253. Of course, this smart meter should not be needed for the Sunny Home Manager.
Then you have only in the Paper UI at the respective smart meter the Change Multicast Group IP Address.
With me, this is done with two smart meters in the system and I can now show both in Openhab.

br
Maik

2 Likes

Unfortunately not…I did open an issue 3 month ago:

My temporarly solution was/is to use:

https://github.com/datenschuft/SMA-EM

With that you get text files that you can read out with a script, e.g.:

#!/bin/sh
value=cat /dev/shm/em-1900252521-psurplus
echo $value
exit 0

…and in my case executed in a rule (EXEC-Binding):

val String sPVResult = executeCommandLine("/etc/openhab2/scripts/energymeter_pv.sh", 5000)

Hope this helps :slight_smile:

BR
Michael

No news about the issue?

Hi @monnimeter
Have you stopped all futher development for this binding?

Hello,
i think the energymeter o in my case th sunnyhomemanager 2.0 dont has this information… but i would like to show up in my oh2 app the actual solar production… like shown in the sunnyportal. this is coming in my case from the inverter in my case a Sunnytripower 6.0 . Is there a posibility to get this data also into the sma binding or maybe also from further devices like a sunnyboystorage, to have information about the batterie etc.?

saludos,

Oliver

Does your inverter (Sunnytripower 6.0) support Modbus? If yes, the Modbus-Binding should be OK to get the data you are looking for.

Hi michael,

Think modbus is posible, but i have no idea how to integrate and use it. I only have a ethernet connection to this device… I will have a look to the modbus binding…

For sure are more people with such sma devices… Otherwise they don’t need the energymeter…

Saludos,

Oliver

And thats the only thing you need :smiley:
I have a SMA Tripower STP 6000TL-20 inverter. It´s connected via ethernet (LAN) and I use modbus in openhab to receive data from it.
I also got a SMA Sunnyboy Storage 2.5 (Battery inverter), which is connected via ethernet and run modbus to openhab.

Let me know if you need the setup. It´s piece of cake :smiley:

Hi Kim,

Cool, great!

I have also a sbs 3.7

Would be nice if you could sent me you config/items and things etc.

Thanks and

Saludos,

Oliver

Here you go.
BUT! Please make sure you have the modbus documentation for your devices. They are not all using the same registers. The below config is for the models I use. So if you copy the below directly and getting errors in reading the registers, you need to change them to the corret ones.
So you should search at SMA´s site for an excell file which contain the info for your devices, (can be alot of pain trying to find the right information on their site. I really hate the structure of their homepage!).

Anyway…

This is the thing file for the Tripower inverter:

Bridge modbus:tcp:inverter1 [ host="10.4.28.248", port=502, id=3, connectMaxTries=3] {

// SMA Inverter Device Type
	Bridge poller DevType [ start=30053, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data DevType [ readStart="30053", readValueType="int32" ]
	   	 
  	 }

// SMA Inverter Status
	Bridge poller SMA_Status [ start=30201, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data SMA_Status [ readStart="30201", readValueType="uint32" ]

  	 }

// SMA Inverter Grid_Contactor
	Bridge poller Grid_Contactor [ start=30217, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data Grid_Contactor [ readStart="30217", readValueType="uint32" ]
	    
  	 }

// SMA Inverter Day Yield
	Bridge poller Day_Yield [ start=30517, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data Day_Yield [ readStart="30517", readValueType="uint64", readTransform="JS(divide1000.js)" ]
	    
   	 }

// Total Yield
	Bridge poller Total_Yield [ start=30529, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data Total_Yield [ readStart="30529", readValueType="uint32", readTransform="JS(divide1000.js)" ]
	    
 	 }

// SMA Inverter Power Section West
	Bridge poller power_a [ start=30773, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data power_a [ readStart="30773", readValueType="int32", readTransform="JS(smalimit.js)" ]
	   	 
  	 }

// SMA Inverter Power Total 
	Bridge poller Active_Power [ start=30775, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data active_power [ readStart="30775", readValueType="int32", readTransform="JS(smalimit.js)" ]
	    
  	 }

// SMA Inverter Power Section East
	Bridge poller power_b [ start=30961, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data power_b [ readStart="30961", readValueType="int32", readTransform="JS(smalimit.js)" ]
	   	 
   	 }

// SMA Inverter Operation
	Bridge poller SMA_Status_Operate [ start=40029, length=4, refresh=5000, type="holding" ] {
    
	    	 Thing data SMA_Status_Operate [ readStart="40029", readValueType="uint32" ]
	    
   	 }

}

And this is the thing file for the SunnyBoy Storage 2.5

Bridge modbus:tcp:inverter2 [ host="10.4.28.249", port=502, id=3, connectMaxTries=3] {


// SMA SunnyBoy Storage 2.5
	Bridge poller device_typ [ start=30053, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data device_typ [ readStart="30053", readValueType="int32"]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Condition
	Bridge poller status [ start=30201, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data status [ readStart="30201", readValueType="int32"]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 GridRelay on/off
	Bridge poller GridRelay [ start=30217, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data GridRelay [ readStart="30217", readValueType="int32"]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Total Yield.
	Bridge poller TotalYield [ start=30529, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data TotalYield [ readStart="30529", readValueType="int32", readTransform="JS(divide1000.js)" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Daily Yield
	Bridge poller DayYield [ start=30535, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data DayYield [ readStart="30535", readValueType="int32", readTransform="JS(divide1000.js)" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Power
	Bridge poller Power [ start=30775, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data Power [ readStart="30775", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 PowerL1
	Bridge poller PowerL1 [ start=30777, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PowerL1 [ readStart="30777", readValueType="int32", readTransform="JS(divide1000.js)" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Grid Voltage L1
	Bridge poller GVoltageL1 [ start=30783, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data GVoltageL1 [ readStart="30783", readValueType="int32", readTransform="JS(divide100.js)" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Current battery state of charge
	Bridge poller CurrentBatStatCharge [ start=30845, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data CurrentBatStatCharge [ readStart="30845", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Current battery capacity
	Bridge poller CurrentBatcapacity [ start=30847, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data CurrentBatcapacity [ readStart="30847", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 PowerDrawn
	Bridge poller PowerDrawn [ start=30865, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PowerDrawn [ readStart="30865", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Power grid feed-in
	Bridge poller PowerGridFeedIn [ start=30867, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PowerGridFeedIn [ readStart="30867", readValueType="int32" ]
	   	 
  	 }


// SMA SunnyBoy Storage 2.5 Battery oper. status
	Bridge poller BatteryStatus [ start=30955, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data BatteryStatus [ readStart="30955", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Status battery application area:
	Bridge poller BatteryAppArea [ start=31057, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data BatteryAppArea [ readStart="31057", readValueType="int32" ]
	   	 
  	 }


// SMA SunnyBoy Storage 2.5
	Bridge poller PowerDrawnGridL1 [ start=31265, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PowerDrawnGridL1 [ readStart="31265", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5
	Bridge poller PowerDrawnGridL2 [ start=31267, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PowerDrawnGridL2 [ readStart="31267", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5
	Bridge poller PowerDrawnGridL3 [ start=31269, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PowerDrawnGridL3 [ readStart="31269", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Present battery charge
	Bridge poller PresBatCharge [ start=31393, length=4, refresh=5000, type="input" ] {
	    
	    	 Thing data PresBatCharge [ readStart="31393", readValueType="int32" ]
	   	 
  	 }

// SMA SunnyBoy Storage 2.5 Present battery discharge
	Bridge poller PresBattDischarge [ start=31395, length=2, refresh=5000, type="input" ] {
	    
	    	 Thing data PresBattDischarge [ readStart="31395", readValueType="int32" ]
	   	 
  	 }

}

And this is my item file for both devices:

// Inverter 1 TriPower 6000
Number inverter1DevType               "Inverter Type [MAP(SMA.map):%s]"                 <solarinverter>                 {channel="modbus:data:inverter1:DevType:DevType:number"}
Switch inverterGridContactor          "Grid contactor [MAP(SMA.map):%s]"                <cu_switch>                     {channel="modbus:data:inverter1:Grid_Contactor:Grid_Contactor:switch"}
Number inverter1PowerA                "Panel SydVest [%s kW]"                           <solarpanel>                    {channel="modbus:data:inverter1:power_a:power_a:number"}
Number inverter1ActivePower           "Active Power [%s kW]"                            <solarpanel>	                {channel="modbus:data:inverter1:Active_Power:active_power:number"}
Number inverter1PowerB                "Panel SydØst [%s kW]"                            <solarpanel>                    {channel="modbus:data:inverter1:power_b:power_b:number"}
Number inverter1DaylyYield            "Inverter Dayly Yield [%s kWh]"                   <line>                          {channel="modbus:data:inverter1:Day_Yield:Day_Yield:number"}
Number inverter1Status	              "Device Status [MAP(SMA.map):%s]" 	        <switch>                        {channel="modbus:data:inverter1:SMA_Status:SMA_Status:number"}
Number inverter1TotalYield            "Inverter Total Yield [%s kWh]"                   <line>                          {channel="modbus:data:inverter1:Total_Yield:Total_Yield:number"}
Number inverter1OpMode                "Operation Mode [MAP(SMA.map):%s]" 	        <text>                          {channel="modbus:data:inverter1:SMA_Status_Operate:SMA_Status_Operate:number"}



// Inverter 2 SunnyBoy Storage 2.5
String inverter2DevType               "Inverter type [MAP(SMA.map):%s]"                 <solarinverter>                 {channel="modbus:data:inverter2:device_typ:device_typ:string"}
String inverter2Status                "Device Status [MAP(SMA.map):%s]" 	        <switch>                        {channel="modbus:data:inverter2:status:status:string"}

String inverter2DayYield              "Dayli Yield [%s Wh]" 	                        <line>                          {channel="modbus:data:inverter2:DayYield:DayYield:string"}
String inverter2TotalYield            "Total Yield [%s Wh]" 	                        <line>                          {channel="modbus:data:inverter2:TotalYield:TotalYield:string"}

String inverter2Power                 "Power [%s W]" 	                                <Energy>                        {channel="modbus:data:inverter2:Power:Power:string"}
String inverter2PowerL1               "Power L1 [%s W]" 	                        <Energy>                        {channel="modbus:data:inverter2:PowerL1:PowerL1:string"}

Switch inverter2GridRelay             "Grid Relay [%s]"                                 <cu_switch>                     {channel="modbus:data:inverter2:GridRelay:GridRelay:switch"}

String inverter2GVoltageL1            "Grid Voltage L1 [%s V]" 	                                                        {channel="modbus:data:inverter2:GVoltageL1:GVoltageL1:string"}

Number inverter2PowDraGridL1          "Power drawn from Grid L1 [%s W]"                 <cu_grid>                       {channel="modbus:data:inverter2:PowerDrawnGridL1:PowerDrawnGridL1:number"}
Number inverter2PowDraGridL2          "Power drawn from Grid L2 [%s W]"                 <cu_grid>                       {channel="modbus:data:inverter2:PowerDrawnGridL2:PowerDrawnGridL2:number"}
Number inverter2PowDraGridL3          "Power drawn from Grid L3 [%s W]"                 <cu_grid>                       {channel="modbus:data:inverter2:PowerDrawnGridL3:PowerDrawnGridL3:number"}

Number inverter2PowerDrawn            "Power Drawn [%s W]"                              <cu_grid>                       {channel="modbus:data:inverter2:PowerDrawn:PowerDrawn:number"}
Number inverter2PowerGridFeedIn       "Power Grid Feed-in [%s W]"                       <cu_grid>                       {channel="modbus:data:inverter2:PowerGridFeedIn:PowerGridFeedIn:number"}


Number inverter2BatteryStatus         "Battery status [MAP(SMA.map):%s]"                <switch>                        {channel="modbus:data:inverter2:BatteryStatus:BatteryStatus:number"}
Number inverter2BatStateCharge        "Current Battery State Charge [%s %%]"            <batterylevel>                  {channel="modbus:data:inverter2:CurrentBatStatCharge:CurrentBatStatCharge:number"}
Number inverter2BatCapacity           "Current Battery Capacity [%s %%]"                <status>                        {channel="modbus:data:inverter2:CurrentBatcapacity:CurrentBatcapacity:number"}

Number inverter2BatAppArea            "Battery Application Area [MAP(SMA.map):%s]"      <text>                          {channel="modbus:data:inverter2:BatteryAppArea:BatteryAppArea:number"}

Number inverter2PreBatCharge          "Present Battery Charge [%s W]"                                                   {channel="modbus:data:inverter2:PresBatCharge:PresBatCharge:number"}
Number inverter2PreBatDischarge       "Present Battery Discharge [%s W]"                                                {channel="modbus:data:inverter2:PresBattDischarge:PresBattDischarge:number"}

Edit, forgot to mention, you should install the latest modbus binding (2.4 or 2.5xx). The above doesnt work for the old v1 modbus binding.

Hi Kim,

i tried everything like you wrote but I cannot see the things, after having created the files….

I have one sma.things file with the two inverters…

Modbus is activated in the two inverter…

The ip address in my case is 192.168.0.22 f.ex… this is the modbus tcp bridge address I guess.

Should I install or config something other ?

The binding itself don’t need config, or ?

Saludos,

Oliver

The modbus binding needs to know, the IP of your modbus slave (your inverter) and its modbus ID. This you should insert in the very first line of the thing file:
Like this.

Bridge modbus:tcp:inverter1 [ host="10.4.28.248", port=502, id=3, connectMaxTries=3]

This line tells the modbus binding, that I have a modbus device connected on TCP (IP) 10.4.28.248 using port 502, and the modbus device has id 3.

When you have done this, your thing should go online, unless you made an mistake in either IP, port or ID. Infact I´m not even sure the ID is required above, since it´s a TCP/IP connection. But @rossko57 probably know better.

EDIT:
I have noticed a few times when I have made changes to the thing file, I´ll need to restart openhab in order to get it online. Cant explain why, but most often this is due to first having made an mistake, and the correct the mistake in the thing file, the device still doesnt come online untill you restart. It can be quite annoying cause it gives the impression, that something is wrong, which it actually isnt.

Modbus “Unit ID” is required in the protocol, even in Modbus-TCP.
The binding can supply a default id=1 if you omit it, and many simple Modbus-TCP devices are factory configured with unit ID 1.
But not all - best to find out.

Background - the reason Modbus-TCP still has Unit ID is to allow gateways - TCP on one side and multiple serial devices on the other. One IP address, with different IDs for each serial slave.

Bear in mind creating a set of Things usually results in the binding setting up a set of timed poller functions, which tick away doing their polling.
I suspect many config editing problems are linked to the difficulty in managing these independent poller “robots” once they’ve kicked off.
Reboot - or binding stop/start - will destroy and create anew.

Bottom line - if editing Modbus things, reboot.