Modbus TCP and Solar Inverter configuration confusion

Tags: #<Tag:0x00007fc90db59220> #<Tag:0x00007fc90db59130>

Hello all,

I’m trying to get my SolarEdge SE3000H / meter combination working with Modbus TCP and SunSpec. I’m on OH 2.5.5 with Modbus 2.5.7. I actually have it working, but I’m getting a lot of errors in the log I’d like to clear up.

I created a modbus TCP slave, which is Online. That auto discovered my modbus Inverter and Meter, and I have added corresponding items which are updating just fine. However, I’m getting this error every 20 seconds.

2020-08-12 01:38:19.371 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/5 error: Connection refused (Connection refused). Connection TCPMasterConnection@3eb1a2c[socket=Socket[unconnected]]. Endpoint ModbusTCPSlaveEndpoint@2fbe5361[address=<removed>,port=1502]

Any ideas how I can debug this?



Standard port for Modbus is 502. The error message shows that port 1502 is being used. Is that done by intention ?
As long as the unencrypted Modbus protocol is used you can use wireshark to sniff the network communication and analyze it.

Seems ordinary enough, the remote end said “No”.
You might review here -

SolarEdge use port 1502 as their default Modbus port, so it is intentional.

Thanks for the pointer to the tutorial - that’s what I needed. It was the remote end saying no, but I couldn’t work out why, given that my modbus items are working correctly, so OH must be talking to my inverter. It turns out I needed to tune the connection, specifically to keep the TCP connection open for a minute, rather than reconnecting after every transaction, and also to wait 100ms between connections rather than trying immediately. I suspect it was the immediate retries that was causing my inverter to complain, because it only supports one slave connection at a time, so if the old connection was still in the process of being torn down, I guess that would result in the refusal of the new connection.

Cheers, Jon

1 Like

All sounds plausible. If you have more than one poller Thing, a TCP target can get slapped with reconnects pretty fast at default settings.

Unfortunately Modbus is all nerdiness :smiley:

Hi @jonwhitear
thanks for sharing your experience with setting up your SolarEdge converter via Modbus.

I am just trying to set up my OH3 connection to the SolarEdge Modbus but still struggeling with a ‘Connection refused’ error, same as you described.

I adjusted the timeouts in my setup as recommended but still can’t establish a connection:

UID: modbus:tcp:46d6d6ce92
label: Modbus TCP Slave
thingTypeUID: modbus:tcp
rtuEncoded: false (also tried true)
timeBetweenTransactionsMillis: 1000
connectMaxTries: 3
reconnectAfterMillis: 600000
port: 1502 (also tried 502)
timeBetweenReconnectMillis: 1000
connectTimeoutMillis: 10000
id: 2 (also tried with 1)
enableDiscovery: false

Thing (Three phase inverter):

UID: modbus:inverter-three-phase:46d6d6ce92:7e7bf95e2f
label: Three Phase Inverter
thingTypeUID: modbus:inverter-three-phase
length: 61
refresh: 10 (also tried 60)
maxTries: 3
address: 40000
bridgeUID: modbus:tcp:46d6d6ce92

Is there anything that I missed? Would you mind to check my settings against yours? Thanks!

Really, don’t just try random stuff with Modbus. Considered choices. It’s either RTU by design or it isn’t.

The implication here is that it has never yet worked, it doesn’t begin to work then throw the error, is that right?
If so, we needn’t worry about any of the timing settings, which only come into play after the first connection.

Please show us your own error message log, sometimes “me too” isn’t quite the same.

You really shouldn’t be guessing at these. This is stuff that you set up on your equipment - what did you set it to?

Did you discover this previously, then turn discovery off?

Here are the settings for my Modbus TCP Slave:

UID: modbus:tcp:a0da1976
label: SolarEdge SE300H Modbus TCP Slave
thingTypeUID: modbus:tcp
  rtuEncoded: false
  timeBetweenTransactionsMillis: 60
  connectMaxTries: 5
  reconnectAfterMillis: 600000
  port: 1502
  timeBetweenReconnectMillis: 200
  host: inverter.<mydomain>
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: true
location: Other

and inverter:-

UID: modbus:inverter-single-phase:a0da1976:40069
label: SolarEdge  SE3000H Inverter - Modbus
thingTypeUID: modbus:inverter-single-phase
  length: 61
  refresh: 5
  maxTries: 3
  address: 40000
bridgeUID: modbus:tcp:a0da1976

I recall when I had my system installed, the installer had to explicitly enable the modbus interface on the inverter - it’s off by default. If this hasn’t worked at all for you yet, that’s probably the place to start looking. There is a SolarEdge provisioning app in which you can change the setting, but only installers have access to that app.

Hi @rossko57, hi @jonwhitear, thanks for picking this up! Your questions pointed me into the right direction.

I rechecked the modbus settings with the company that did the installation and found out that ‘modbus over tcp’ just wasn’t enabled at all :see_no_evil: (which was not visible in the SetApp read-only mode). They now enabled it and everythings is running fine now. I also adjusted the timing setting and will now start digging into monitoring :slight_smile:

Thank you guys!

1 Like