New binding available: SolarEdge binding

This may be a tampering security concern i.e. there is none with Modbus.

Hi Bert (@rori1977),

I have a SolarEdge SE2200 inverter and was able to activate the ModbusTCP with the LCD and the Service button on the bottom of the inverter. No need to use the Set App.
Instructions are described in this document: Technical Note – SunSpec Logging in SolarEdge Inverters (can be found in the Solaredge document library).

If you have issues, you can write me a PM (I am German as well).

@rossko57: you are right. With this solution, there is less security, but having your local network under control and the firewall of the internet connection well set, this risk is acceptable.

Jonathan

1 Like

Had to update this post. Acess directly with my python script works. I can read everything even the detailed meter data without problems. so it seems to be only a OpenHab Bindings issue. i might have an error somewhere.

attached what i have so far in OpenHab

@elektrolubach thanks for the point in the right direction.
i have the MTR-3Y-400V-A Meter installed

The Thing for the Meter does not connect and event though the Inverter seems online i cant receive data. But i reveive API data from the web.

Hi @Deepdigger,

I had to adapt the “start address” and “block length” of the modbus:sunspec things. The default settings are not correct. I took the values from the SolarEdge document linked above.

My settings for the inverter are:
Start address: 40069
Block length: 50

And for the meter they are:
Start address: 40188
Block length: 105

By the way: I have a WNC-3Y-400-MB modbus meter. Maybe yours behaves different.

Jonathan

1 Like

Hello Jonathan,

some progress: After installing the modbus binding on my Raspi2
(brand new OH3.1.0.M3 using OpenHABian 1.6.4)

UID: modbus:tcp:3b4da561fd
label: Modbus TCP Slave
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  reconnectAfterMillis: 600000
  connectMaxTries: 3
  timeBetweenTransactionsMillis: 60
  port: 1502
  timeBetweenReconnectMillis: 200
  host: 192.168.1.183
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: true

I can successfully detect and see both the inverter

UID: modbus:inverter-single-phase:3b4da561fd:40069
label: SolarEdge  SE5000H-DE000BNN4
thingTypeUID: modbus:inverter-single-phase
configuration:
  length: 50
  refresh: 5
  maxTries: 3
  address: 40069
bridgeUID: modbus:tcp:3b4da561fd

and the meter

UID: modbus:meter-wye-phase:3b4da561fd:40188
label: WattNode WND-3Y-400-MB
thingTypeUID: modbus:meter-wye-phase
configuration:
  length: 105
  refresh: 5
  maxTries: 3
  address: 40188
bridgeUID: modbus:tcp:3b4da561fd

I have adapted the autodetected values to your recommended settings.
I can see incomming data both with autodetected setting AND with the manual overrides you provided, however I somehow fail to see the (to me) most important channels such as “Production, Import, Export, Consumption” (actual name of these channels might differ, ).

I can see channels that go into a similar direction, but I feel these are not the one I should use.

Can you share the names of the channels that you are using?

I can see the following channel list, which - I believe - might be incomplete:

Any hints appreciated!

Hi @rori1977,

you’re on the right path.

With the ModBus Binding you can only get the measurement data the inverter or/and the meter provide. These are actual values like the AC/DC voltage, current and power (among all the other values).

I can see the following channel list, which - I believe - might be incomplete:
<>

I think, for the inverter this list is complete (check with the binding docu if in doubt).

[…] however I somehow fail to see the (to me) most important channels such as “Production, Import, Export, Consumption” (actual name of these channels might differ, ).

I think you like to see the actual power value - this is what I am using the ModBus Binding for - then these values are as follows:

  • Production = Inverter → AC Power Value (channel: modbus:inverter-<inverter-type>:<inverter-id>:40069:acGeneral#ac-power)
  • Import/Export = Meter → AC Total Real Power (channel: modbus:meter-<meter-type>:<meter-id>:40188:acGeneral#ac-total-real-power) → importing when >0, exporting when <0
  • Consumption = calculated, see next paragraph

In contrast to the SolarEdge Binding (which fetches data from the SolarEdge Monitoring portal) you will have to calculate some values on your own, e.g. the actual self-consumption power value.

You can have a look into this post: Solaredge inverter via Modbus TCP 2 - #21 by elektrolubach. At the end of the file solaredge.rules, there are four rules for the calculation of these values:

  • SE2KM_EigenverbrauchGesamt → Self consumption (Energy [Wh]);
    formula: self consumption = production - export
  • SE2KM_GesamtverbrauchGesamt → Total consumption (Energy [Wh]);
    formula: total consumption = import + production - export
  • SE2KM_SolarerDeckungsgradGesamt → Percentage usage of PV (dimensionless);
    formula: self consumption / total consumption * 100%
  • SE2KM_VerbraeucheMomentan
    → Actual power at the grid connection point (Power [W]);
    formula: grid power = meter value AC Total Real Power
    → Actual power consumption of the house (Power [W]);
    formula: actual power consumption = production - grid power
    → Actual power self consumption of the house (Power [W]);
    formula: actual self consumption = production (+ gridpower, if negative)

I hope this helps :slight_smile:

Jonathan

3 Likes

Hi,

since 2 or 3 weeks, just got an “UNDEF” for current production.

SE api access seems to working fine (based on OH3 UI). Am I the only one, or is there something general with the SE API?

Thanks in advance.

Rgds
Andre

Hi,

I have been using the SolarEdge binding for a few years now. I think back in the days when I set up my items, the unit for the aggregate_day#production channel was set to “Tagesproduktion [%.2f kWh]”.

At least for the past few months I noticed that whenever the aggregate daily production was below 1 kWh, the item would always show something like “600 kWh” when instead only 600 Wh were produced. As soon as 1 kWh is reached, the unit is correct.

I would have suspected the binding to return 0.6 for 600 (Wh), and not 600 when afterwards 1 kWh is returned as “1”? What am I missing here?

For me the daily aggregate works fine also if production is less than 1kWh. Today in the morning it showed me 0.1 kWh. So this is either an individual configuration error. Another reason could be that due to different APIs or existence of a meter the data is retrieved slightly different.

In my setup I use this configuration:

meterInstalled=true
usePrivateApi=true

BR
Alex

Works fine for me, but I defined it this way in the items file:

Number:Energy PV_Aggregate_Day_Production "Produktion (Tag) [%.2f %unit%]"

Maybe the %unit% and Number:Energy helps at your side, too?

Number:Energy SE_DAY_PRODUCTION “Ges. Produktion [%.1f kWh]”

It is possible (and also recommend when using persistence) to enforce a specific unit. This triggers conversion. But this only works when the correct type is used (Number:Energy). If you just use the raw type it will not work. It will then use whatever the binding returns and just append “kWh” to it.

2 Likes

I now added Number:Energy and am using [%.2f kWh], see Screenshot below.

I am still not seeing 0.457 kWh though, I am now getting 457 Wh (which is technically correct of course, but I would much rather have it show 0.457 kWh, especially as I am showing that value in Grafana and also would like to use those numbers for calculation, which might be hard when it’s not always the same unit (Wh vs. kWh).

Edit: I forgot to mention, my SolarEdge thing is also setup with meterInstalled=true and usePrivateApi=true.

Unfortunately, the state presentation ‘pattern’ (the bit, or ‘pattern’ in
Item metadata) was hijacked years ago to also provide a quantity type Item’s default unit.
It is dual purpose, and so it is difficult to assign a default unit, and then display in a different unit.

This could be done in BasicUI + sitemap by giving an overriding “label [unit]” to the sitemap widget, and auto-conversion will happen.

In MainUI I think you would have to build a custom widget to do your own conversion. Clearly the auto-conversion to arbitrary units is somewhere in the framework for BasicUI, but I don’t think anyone has found how to access it in MainUI.

1 Like

I am a little confused. I mean, seeing for example 569 Wh and later on 1.5 kWh in any openHAB UI would be fine with me.

The problem I have now is that I would like to use those values in rules and to “calculate stuff”, and I would also like to display charts and numbers in Grafana. Not sure how to do that now that the items has different units throughout the day.

Will I have to create a second item (Aggregate_Production_kWh) and on change of the “production item” (Aggregate_Production) find out if the current unit is Wh and then calculate kWh from that and set it to the Aggregate_Production_kWh item?

That part is easy, you can always get a quantity type Item state in the units of your choice in rules.

Here you depend on persistence, the historic record. That does not record units, so you must ensure your Item always has the same base unit when it is recorded to ensure consistency.

I know persistence uses the Items default unit to reconstruct values when retrieving records.
I am not sure if it uses the default to do a conversion before recording, if the current unit happens not to be the same as default. If it does, everything is good.

I think you need to be sure that is happening first, I would not trust UI displays. Look in your events.log to see real state changes (with units).

Here is a screenshot of my event.log for two items that are set up the exact same way:

So it seems like it just records the value without doing any conversion? That’s what I am seeing in my Grafana panel as well, as:

image

In a while this will switch over to 1 kWh in Grafana.

Weird stuff happens. A demo -

// test Items - a non-quantity, a quantity with default, and a quantity without default
Number testN "testing  [%.1f kWh]"
Number:Energy testE "testing  [%.1f kWh]"
Number:Energy testX "testing"

// test rule
testN.postUpdate("10")  // no units
testE.postUpdate("10")
testX.postUpdate("10")
Thread::sleep(1000)
testN.postUpdate("15 Wh") 
testE.postUpdate("15 Wh")  // unit doesn't match default
testX.postUpdate("15 Wh")
Thread::sleep(1000)
testN.postUpdate("25 kWh")
testE.postUpdate("25 kWh")
testX.postUpdate("25 kWh")

results

2021-12-21 12:40:22.734 [vent.ItemStateChangedEvent] - testN changed from NULL to 10
2021-12-21 12:40:22.735 [vent.ItemStateChangedEvent] - testE changed from NULL to 10.0 kWh
2021-12-21 12:40:22.736 [vent.ItemStateChangedEvent] - testX changed from NULL to 10

Pretty much what you would expect. A unit is assumed for testE when posting just-a-number. testX is just messed up - no unit given, no default either, pretty meaningless.

2021-12-21 12:40:23.750 [vent.ItemStateChangedEvent] - testN changed from 10 to 0.015 kWh
2021-12-21 12:40:23.757 [vent.ItemStateChangedEvent] - testE changed from 10.0 kWh to 0.015 kWh
2021-12-21 12:40:23.759 [vent.ItemStateChangedEvent] - testX changed from 10 to 15 Wh

Woah, that surprised me. The plain Number Item has actually done an auto-conversion to a default unit. I expected that to load with 15Wh. But of course it isa nonsense posting units to a plain Number - this is just exploring.
testE has done what I expected - auto-converted the update to the default unit, good.
And testX (with no default) just accepts what unit it was given.

2021-12-21 12:40:24.754 [vent.ItemStateChangedEvent] - testN changed from 0.015 kWh to 25 kWh
2021-12-21 12:40:24.762 [vent.ItemStateChangedEvent] - testE changed from 0.015 kWh to 25 kWh
2021-12-21 12:40:24.763 [vent.ItemStateChangedEvent] - testX changed from 15 Wh to 25 kWh

This is all as expected.

Of course this is postUpdate from rules, it is not quite the same as channel updates from a binding.
What we’re not sure of here is exactly what the SolarEdge channel is posting to the Item - with or without units?
You could confirm this by creating test plain Number type Items, with no [default] but perhaps just [%s], and link those to your SolarEdge channels as well as your regular Items. Not all the channels might be alike here.

What I’m driving at here is that if the channel posts updates with units, I would expect the Item to auto-convert to user-defined default unit, which takes care of all your worries.

Note also that when defining Items from text files OH2 style, the [default] given in a label may not end up in the OH3 metadata ‘pattern’. The test Item acting most like your observations is the one with no default assigned. We might have to check this out on your Items.

1 Like

Wow, thank you for the test!

I was actually looking for the bindings source code, but didn’t find it (right away, didn’t put much time into the search to be honest).

So maybe the update to the items is just incorrect from the bindings site, missing the units, if I understood correctly?

I added a new number item, but right now all of those items are at >= 1 kWh, so it’s hard to see it that changes anything?

I think there is more to it than that, the Wh unit did not appear by itself.
But we must not assume all channels are acting alike.

The screenshot suggests your just-a-Number test is getting updates without units. Do check events.log as well.

Correct, I missed that.

So I guess that could be a “bug” in the binding?