Reading Data from Solaredge inverters via Modbus TCP

I think what you are suggesting is to have openHAB emulate a meter?
As I understand the setup to be emulated - the inverter is acting as Modbus master to read a meter, which is Modbus slave. Modbus is not peer-to-peer, it is master-slave.

The existing OpenHAB Modbus binding is only capable of acting as Modbus master - it cannot be used to emulate the meter directly.

That doesn’t mean it can’t be done - but you would need some new specialist “slave mode” script or binding to do it.

The Modbus binding does provide a development interface for “add-on” device-specific bindings that use the underlying mechanics for the protocol.
I would guess the base binding would still need changes though for master mode.

It is possible in Modbus-TCP in general for one box to act as both master and slave to different partners.
This is not really workable for Modbus-RTU over serial - one bus should have one master.
But a single box can provide multiple serial buses and/or LAN. I expect this is what the inverter can do, and so can openHAB.

The openHAB end doesn’t care what means of TCP transport you use.
Your router will generally bridge from one to the other along the way.

It was more a question from the solaredge perspective, I’m still rather lost in the documentation as it’s all new to me but to my reading it will only do TCP over ethernet cable, not over wifi? Also questioning whether it will do both the solaredge portal comms AND TCP, or whether you only have an either/or option; I’m wanting to retain the solaredge portal as the primary, but have the option of querying the inverter directly.
Hmm, digging deeper into the documentation it appears that it should do both TCP and portal comms, if you enable modbus TCP on the inverter it will default to port 1502. All docs only talk about using ethernet, but as the wifi option is apparently only available for EU and APAC I wonder if it does work over wifi but just isn’t documented? Might be worth a test.
(actually it says port 1502 in one place and 502 in another, but the config screen should show the port anyway)

RE: emulating a meter, I’d be happy to have a different hardware connection on RS485 acting as a slave, but have no idea how to set this up or configure the data to be in the right sunspec format.

My experience getting real-time data from my SolarEdge inverter via Modbus TCP has been bumpy.
Initially, things worked super great and I was pumped at how (relatively) easy it had been to get things working!
Then I started getting tons and tons of repeated “connection refused” errors.
I suspect what happened is that OpenHAB rebooted, or maybe I had a network interruption, and during this time, the inverter Modbus TCP server timed out (2 minutes, apparently), and stopped accepting connections?
Or maybe I restarted the inverter (don’t do it frequently…) and that’s when the MB TCP server timed out?
In any case, tonight I went out, killed power to the inverter, powered it back on, and then within 2 minutes, re-implemented my Modbus thing in OH that reads data from the inverter. Poof. Everything worked.

So my questions are:

  • does anyone know when the SE inverter’s 2-minute Modbus TCP server timeout applies? Do you just need to connect within the very first 2 minutes that the inverter is powered up, and then you are good? Or do you need to connect every 120 seconds, else the server goes idle and stops accepting connections?
  • is there any way to reboot the SE Modbus TCP server without cycling power to the inverter altogether? (i.e. with a handy-dandy OH rule???)
  • any thoughts on a rule on detecting repeated modbus refused connections with an OH rule? I’d love to send a notification via Prowl in this case.


You can certainly detect errors and run rules to “do something”, like messaging.
I cannot help with what the “do something” ought to be for Solaredge recovery.

I expect you’re doing this already, but make sure your router DHCP is set up to issue static IP addresses to to openHAB and Solaredge, or set fixed addresses in them, in case the “loss” was due to unexpected IP change.

Awesome, thanks, I will check out the Modbus error management post.

Yes, I’ve got fixed IP reservations for almost everything on my network. Critical for presence/network detection (whole different topic of course).

I’m considering to get a Solardge inverter, too (an SE7K), and also stumbled across this.
The SunSpec doc says to connect using Modbus/IP via physical Ethernet.
Inverter docs say there’s an internal Ethernet port and the option for a WiFi module.
The box however is said to be setup using WiFi only - the “SetApp” app is said to use a local WiFi between your box and your smartphone. But I have not seen any mention of how to configure that WiFi on the inverter to use DHCP w/ an Internet router for regular operation.

Could someone to run OH with any of these boxes clarify if I can actually make USE of WiFi instead of Ethernet ?

I just tried to enable Modbus on my wi-fi enabled SolarEdge inverter but I get the error “Disconnected” which according to the doc means the ethernet cable is not connected so looks like you can’t setup the connection without hard wiring.

Thanks for checking out. Which model is that ? Am I correct in assuming you do NOT have the “WiFi” option?

I’ll never understand HVAC engineering people I think. I have a ventilation unit (marketed with a cloud monitoring, even for free) but again Ethernet only. All of these to be placed in a location (basement or attic) where really noone has prepared for a cable. WiFi is so much more the obvious choice as it does not require deploying another cable. Cheaper even, price of some ESP8266 is well below $10.
But this now is really topping it. They have even added WiFi for sake of an easy setup but you cannot use it ?? :roll_eyes:

It’s a SE7300. I do have the wifi option which is how it communicates with the solaredge mothership and enables the smartphone app. I’m going to run an ethernet soon as I currently use the solaredge binding but it only refreshes every 10min and every now and again the solaredge mothership has issues updating.

Now you left me even more confused.
The SetApp requires the inverter to have WiFi so there must be WiFi inside even if you don’t get the WiFi option, right?
I found the following saying WiFi IS in and just requires an antenna ?

What do you mean by “mothership” - a cloud portal ? Some other local device ?
I thought the binding would connect to the inverter and not to some cloud server ? And you cannot configure it how often to refresh ?

Sorry if that sounds silly but for someone to not have these devices yet that’s very confusing.

Markus, maybe you should consider SMA inverter insted, they´re even german :slight_smile:
They have both WiFi and ethernet. (Their TPL inverters might have WiFi as optional. But my SMA Sunnyboy Storage 2.5 has both ethernet and Wifi as default. (I only use ethernet for my SMA inverters though)).

Yes, the mothership is a cloud portal that was also developed so that installers can monitor their clients and get alerts for bad panels, etc.

There is another SolarEdge binding that essentially polls the cloud portal using an API key but it has been restricted by SolarEdge to stop people smashing their servers. By using the Modbus binding you can go direct / local. While the doc mentions wifi you do need the aerial and all the setup can be done direct on the inverter screen so possibly you don’t even need it to connect to the internet.

Bottom line is that you will need the ethernet cable plugged in for the Modbus TCP to bind to, possibly you can stick the other end into a powerline or wifi extender if you can’t physically run an ethernet cable to your router.

There seems to be no binding for SMA inverters, just hand-scripted stuff ?
Well the real problem in Germany is that you cannot simply compile components on your own but have to take what your PV supplier offers in his bundle, and for my preferred supplier that’s a Solaredge device.
Another offer used a Kostal inverter (German, too, and there’s a binding available, too).

Ah, that now helped me understand. Thanks.
So I will want NOT to get the WiFi option or use the builtin WiFi (which is there for newer devices for the sake of an easy setup) because that would make me depend on their cloud portal.
Instead I’ll use this binding here to read the local Modbus. And that would NOT work via WiFi even if I had the WiFi option so I need to connect to Ethernet for this.
Most likely I’ll place the inverter next to my switch anyway.
Anyone without Ethernet in range can use a WiFi repeater - I also do that already with another Modbus-Ethernet-only unit I have for ventilation, installed in the attic.

They run modbus (= they work everywhere). So you dont need a specific binding.

I have a Kostal inverter running, but it’s a smaller version which has a different interface than needed for the Kostal Binding :frowning: The I also sought to interface via the RS-485, but thats also not so easy.
One year late I installed some more solar at another place with a Growatt inverter, again different interface.

So I decided not to hazzle around with all the different interfaces and just put a power meter with 2 clamps into my central E-distribution. It sends the data via MQTT to OH and is based on an ESP32.
So the current solar gain can be used by OH. If I want more statistics and history data, I still can interface with the inverters via thei web interface.

This is what I have done, and it’s working well. You should be able to pick up a very cheap WiFi router that can attach to your main network for very low cost - maybe $10 USD if you pick up a used router.

Out of interest, does the portal / app gui continue to work when you enable the modbus? Docs indicate it should but keep to know for sure.

Yes, SolarEdge’s portal continues to receive data from my inverter. However, my inverter has a cellular connection through which it forwards data to SolarEdge; if yours has always been feeding to the cloud over network connection, I’m not sure if connecting via Modbus would affect that.