Reading Data from Solaredge inverters via Modbus TCP

Yes. Just like you do with Astro or Weather bindings.

His problem is with the Solaredge binding that uses the manufacturer’s web API. He has to supply an API key, etc.

He is not (yet) using the Modbus based Sunspec binding, which is not yet fully merged into OH.

The SolaEdge Binding that I currently use, let’s me choose.

Option 1 - using (a shorter) API Key:
Here I can re-download the content from the Public API. Officially supported.

Option 2 using a (significantly longer) security token (that intercepts ModBus traffic):
Download from a local source, but only 1x per minute. Private API, not officially supported.

To me the currently used binding makes it easy to get startet, however it seems to come with that awkward limitation, that the other binding (mentioned by Petr) seems to not have.

Is there an ETA on when the Sunspec Binding will be merged?

You can follow progress here. It may make release 2.5.4

1 Like

Hello,
I am trying to connect my SE5000H Single phase SetApp inverter through Modbus. I have enabled Modbus TCP with standard port 1502 in the Inverter through SetApp.
Is there any time limits in which the ports are available, or it does not matter?
How can I test, if the port is reachable?

My settings:
modbus TCP seems to be online, whatever is setted in:

UID: modbus:tcp:d76ff7b8b0
label: SE Modbus TCP Slave
thingTypeUID: modbus:tcp
configuration:
  rtuEncoded: false
  timeBetweenTransactionsMillis: 60
  connectMaxTries: 1
  reconnectAfterMillis: 0
  port: 1502
  timeBetweenReconnectMillis: 0
  host: 192.168.1.105
  connectTimeoutMillis: 10000
  id: 1
  enableDiscovery: false
location: Vchod

1ph inverter is Error with read: org.openhab.core.io.transport.modbus.exception.ModbusConnectionException: Error connecting to endpoint ModbusIPSlaveEndpoint [address=192.168.1.105, port=1502]

UID: modbus:inverter-single-phase:d76ff7b8b0:c88c825712
label: SE5000H Single Phase Inverter
thingTypeUID: modbus:inverter-single-phase
configuration:
  length: 61
  refresh: 5
  maxTries: 3
  address: 40000
bridgeUID: modbus:tcp:d76ff7b8b0
location: Vchod

and the same for meter:

UID: modbus:meter-wye-phase:7fdcd65a9c
label: SE Three Phase Meter, Wye-Connected
thingTypeUID: modbus:meter-wye-phase
configuration:
  length: 61
  refresh: 5
  maxTries: 3
  address: 40000
bridgeUID: modbus:tcp:d76ff7b8b0
location: Vchod
2021-12-28 21:10:35.665 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/1 error: Spojenie odmietnuté (Connection refused). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.105, m_Port=1502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=192.168.1.105, port=1502]

2021-12-28 21:10:35.666 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 1, throwing last error: Spojenie odmietnuté (Connection refused). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.105, m_Port=1502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=192.168.1.105, port=1502]

2021-12-28 21:10:35.668 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.105, m_Port=1502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=192.168.1.105, port=1502]: Spojenie odmietnuté (Connection refused)

2021-12-28 21:10:35.669 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=192.168.1.105, port=1502] -- aborting request ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=40000, length=61, maxTries=3] [operation ID 1f3fac1a-4ef8-4d0b-ab9e-3f905fdb6472]

2021-12-28 21:10:35.682 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/1 error: Spojenie odmietnuté (Connection refused). Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/192.168.1.105, m_Port=1502, m_ModbusTransport=null, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=192.168.1.105, port=1502]

What I am doing wrong? according to documentation, starting with address 4000 seems to be legit…
Michal

The advice here applies

but -

this does look like a basic error with IP, port, or ethernet pathway

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?