Reading Data from Solaredge inverters via Modbus TCP

For my Solaredge inverter the TCP Modbus Port was 502 by default. Please check if yours is actually at 1502…

Other than that, i can recommend MBMD to read from Solaredge inverters via Modbus and pipe the data into openHAB via MQTT. MBMD is helpful to present them via MQTT with the homie standard, so your channels will be autodiscovered. It also good to test basis connectivity, if nothing else.

Best, Thomas

Here‘s how my basic /etc/mbmd.yaml config fiile would look like to read from SE:


#REST api, use 127.0.0.1 to restrict to localhost
api: 0.0.0.0:7071
rate: 3s

# mqtt config
mqtt:
  broker: localhost:1883
  topic: mbmd
#  user:
#  password:
  clientid: mbmd
  qos: 0
  homie: homie

# adapters are referenced by device
adapters:
#- device: /dev/ttyUSB0
#  baudrate: 9600
#  comset: 8N1 # "8E1" needs be quoted as string or will error
- device: 192.168.x.y:502
  rtu: false # Modbus RS485 to Ethernet converter uses RTU over TCP

# list of devices
devices:
- name: pv
  type: sunspec
  id: 1
  subdevice: 0
  adapter: 192.168.x.y:502
- name: grid
  type: sunspec
  id: 1
  subdevice: 1
  adapter: 192.168.x.y:502

You can watch it work using it‘s inbuilt webserver at localhost:7071. Just comment out the mqtt section if you don‘t want mqtt.

1 Like

My default port is 1502 in the inverter. I even tried to change it to 502, does not work. I have power cycled the inverter, nothing is changed. I need to say, my inverter is not connected by Ethernet, only though WiFi. Could this be a problem?

it should not be a problem. However, please follow Rosko‘s advice to ensure basic IP connectivity to the interver works.

I have tried mbpoll and it seems that my inverter does not want to talk to me:

pi@WeeWX:~ $ mbpoll -p 1502 -r 40000 -v -a 5 192.168.1.105
debug enabled
iGetIntList(5)
Integer found: 5
iCount=1
Set device=192.168.1.105
mbpoll 1.4-12 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Connecting to [192.168.1.105]:1502
**mbpoll: Connection failed: Connection refused.**

or

pi@WeeWX:~ $ mbpoll -p 1502 -r 40000 -v -a 5 192.168.1.105
debug enabled
iGetIntList(5)
Integer found: 5
iCount=1
Set device=192.168.1.105
mbpoll 1.4-12 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Connecting to [192.168.1.105]:1502
**mbpoll: Connection failed: Operation now in progress.**

I have power cycled the invertor several times, changed the port to 502 on the inverter and mbpoll too, played with RS485-1 and RS485-2… nothing helps.

Looks like Inverter problem? Is there someone having similar Inverter?

I don’t want to connect the Inverter over ethernet, as I am afraid of Thunderstorms.

Thanks,
Michal

Can you see Data from your inverter via the mySolarEdge app? That at least would show that the inverter is connected via the Wifi and it’s just Modbus being difficult. Also, can you verify that 192.168.1.105 is indeed the correct IP-Address for the inverter? Are you using DHCP? In that case you should set a static mapping for the MAC address of the inverter. Can you ping the interverter? Only if those things work try to debug the Modbus connectivity further.

  • yes, I can see the inverter data + monitoring through mySolarEdge app (wifi) + on the monitoring portal
  • yes, I am using static addresses for all my connected devices (mikrotik) and I am sure the IP belongs to inverter
  • yes, I can successfully ping my inverter

Before I have checked the inverter with mbpoll, i have disabled the OpenHAB MODBUS addon.
Will it help to find if the port 1502 is open? In manual, they wrote, the inverter is waiting for connection, so I am not sure, if the port is open from beginning.

Hi @misko903,

did you have a look into the Tech note from SE?

There is some idle time of 2 min mentioned, but I didn’t experience this in my setup with an SE2000 at any time. Maybe this has changed?

Cheers
Jonathan

Hi Jonathan,
yes, I saw it. I did try after power cycle, but nothing has been changed.
is your Slave ID value = 1? are my things parameter same like yours?

thanks,
Michal

Hi @misko903,

yes, in the Modbus TCP Bridge my Slave id is set to 1:

UID: modbus:tcp:solaredgeModbusTcpBridge
label: SolarEdge Modbus TCP Bridge
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  timeBetweenTransactionsMillis: 60
  connectMaxTries: 1
  reconnectAfterMillis: 0
  port: 502
  timeBetweenReconnectMillis: 0
  host: 192.168.115.164
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: true

Same as for @tkuehne, my default port is also 502.

The settings for my inverter is as follows (using the sunspec things definitions with auto discover):

UID: modbus:inverter-single-phase:solaredgeModbusTcpBridge:40069
label: SolarEdge  SE2200 Inverter
thingTypeUID: modbus:inverter-single-phase
configuration:
  length: 61
  refresh: 5
  maxTries: 3
  address: 40000
bridgeUID: modbus:tcp:solaredgeModbusTcpBridge

And the meter is set as follows:

UID: modbus:meter-wye-phase:solaredgeModbusTcpBridge:40188
label: SolarEdge WattNode Meter
thingTypeUID: modbus:meter-wye-phase
configuration:
  length: 61
  refresh: 5
  maxTries: 3
  address: 40000
bridgeUID: modbus:tcp:solaredgeModbusTcpBridge

Luckily I have an LCD on my inverter where I can check the status of the Modbus and it switches between “clear” and “connected” regularly according to the polling cycle of the OH modbus settings. Is this also visible in the SetApp?

Cheers
Jonathan

Thanks Jonathan,
this looks pretty the same like mine/standard ones. Except the port, as I red that for SetApp Inverter standard is 1502.
I haven’t seen any Modbus Statuses in SetApp.
Is your connection made Wireless, or Wired?

Michal

It is wired, indeed.

But what difference would that make? This should just affect the transport layer, not the application layer…

Maybe you can ask SolarEdge directly? For German users they have a very good support in Munich - I recently talked to them to fix some setting in my direct consumption settings and they answered very quickly via email and telephone.

Cheers
Jonathan

Yes, I have done that earlier today, but it looks like very general answer, all the stuff are already in the SE Sunspec PDF note:

For MODBUS over TCP Configuration:

MODBUS/TCP uses the standard 100 Mbps Ethernet media in physical layers to carry the MODBUS message handling structure.

Here, it is used for remote 3rd party monitoring and control. MODBUS TCP is agnostic of the server connection.

It works only over LAN. When configured, MODBUS TCP does not initiate a connection. The server waits for a client to connect. Only one connection is supported.

To setup MODBUS TCP:
Select Communication → Modbus TCP port ->Activate (the default port for 1502 can select between 1025-66535)
To modify the TCP port, select Modbus TCP → TCP Port, set the port number and long-press .
When the MODBUS TCP feature is enabled, the following status screen is shown:

Status:
Init – Initializing server – This state only occurs after the first configuration until it reaches the ready status. This activity lasts about 10 seconds.
Ready – The server is up and waiting for a client to connect.
Connected – The client is connected.
Failed – The server is unable to accept clients (see error message).
Error messages:
Disconnected – The Ethernet cable is not connected
Gateway Ping Failed. – A ping to the 1st router failed
No IP - Either no DHCP configuration or static IP config (no DHCP server that assigned an IP address) or need to define a static IP.

I’ll try to answer them more specific questions.

Greets to Germany!
Michal

Is your target IP address on the same subnet as your OH/MBpoll host?

Yes, it is. I will try to use Google DNS service / deactivate pihole in my network, but this should not affect the results I hope
EDIT: No change, even I have rebooted whole system.
Further ideas?

Answer from SE Support:
Basically, they said I would need Ethernet Cable to connect it.

Hello,

3rd party logger for Modbus over TCP works only over LAN, you can use standard LAN cable CAT5 with RJ45 connector.

Connection through WiFi is connecting the inverter to internet and SolarEdge monitoring portal.

Eventually you can connect the 3rd party logger into RS485-2 and then set as following:

To configure the inverter (when used without the Control and Communication Gateway):

Under the Communication menu, set the following:

Communication → RS485-2 Conf
RS485-2 Conf → Device Type → Non-SE Logger
RS485-2 Conf → Protocol → SunSpec
RS485-2 Conf → Device ID and enter the MODBUS address (a unique value 1…247). This will set the register C_DeviceAddress.
If needed, set the baud rate to a preferred value: RS485-1 Conf → Baud rate and enter the rate.

In this case you need to have connected the 3rd party logger into RS485-2 port.

Make sure the device ID of the non-SolarEdge monitoring device is different from all other device IDs configured in the inverters.

For more details you can visit:
https://www.solaredge.com/sites/default/files/sunspec-implementation-technical-note.pdf

If you cannot run a cable, then you can get little WiFi-to-RS485 converters with Modbus gateway capability
https://www.ebay.co.uk/itm/373763823648

Thanks, looks fine.

I have the possibility to route cable from inverter to switch, but I am afraid of storm then…
Should be similar as this: Serial Port RS485 zu WiFi Gerät IOT Server Modul Elfin EW11 Unterstützung TCP/IP Telnet Modbus TCP Protokoll|Building Automation| - AliExpress

The problem is, t needs to be ppowered

Hello,
so here the final answer from SolarEdge support team - I have even proposed them to implement Modbus/TCP over WiFi interface - answer at the end of their reply:

MODBUS/TCP uses the Ethernet media in physical layers to carry the MODBUS message handling structure because it can support a large number of devices in one network. The Wi-Fi communication option enables to wirelessly connect a SolarEdge device to the SolarEdge monitoring server and does not support the MODBUS/TCP.

I have passed your idea to our Resolution and Development team, however cannot promise or tell you when it can be implemented.

My solution - I will try to connect the inverter to router with the LAN cable to know, if it will work. Then I will see. I believe my home automation should work without internet :slight_smile:

Hello,
I think the reply from SE Support is not correct. Just a few weeks ago they opened port 1502 for me and I can read from Modbus via WiFi successfully. I use the Modbus binding together with the SunSpec addon binding.

Regards Christoph

That is interesting. Are you using official solaredge energy monitor on RS485-1 and RS485-2 is free? How about your config?
Thanks!