Modbus Binding and SofarSolar Inverter (RS485 Connection)


I tried setting up the Modbus Binding to read some values sent by my SofarSolar inverter. The connection is being made via the RS485 Port of the inverter, connected to an USB to Serial converter on a Raspberry Pi 4B running the newest version of openhab. Everything I did was done through Paper-UI.

Maybe this is a simple problem you guys know how to fix already but I just can’t seem to get it to work:

As a first step I created a Thing “Modbus Serial Slave” with the necessary configuration as given from the inverters documentation (9600 Baud, 1 stop bit, parity none, …) and serial port “/dev/ttyUSB1”. This is the converter, I double-checked.

After saving this thing, it gets created successfully and is online. All good so far.

Then I tried to create a Regular Poll Thing with the Modbus Serial Slave as parent bridge to start polling for data to fetch.

This thing never comes online. Whatever settings I make, the error stays the same:

Error with read: Error connecting to endpoint ModbusSerialSlaveEndpoint [getPortName()=/dev/ttyUSB1]

So at this point, I stopped from going further because I guess there is no point as long as this error remains. What exactly do I have to do?

There is also the question on what to put in the Poll Thing, it asks for “Start”, “Length” and “Type”. I am not sure if it is related to the problem I face right now. It already fails at connecting with the converter whereas the Serial Slave connects without problem.

Thanks for your time!

You sure its ttyusb1 ?
Did you had a look at this

hello stamate_viorel!

Yes, I looked at that already, but maybe I didn’t understand everything what is being said there.

I am fairly sure it is the right device. This is what dmesg shows me:

[    4.038906] usb 1-1.3.4: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[    4.038973] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.039035] usb 1-1.3.4: Product: FT232R USB UART
[    4.039079] usb 1-1.3.4: Manufacturer: FTDI
[    4.039123] usb 1-1.3.4: SerialNumber: AQ034ZG0
[    5.451740] ftdi_sio 1-1.3.4:1.0: FTDI USB Serial Device converter detected
[    5.451922] usb 1-1.3.4: Detected FT232RL
[    5.462218] usb 1-1.3.4: FTDI USB Serial Device converter now attached to ttyUSB1

The Modbus Serial Slave is online using this device as well. The Regular Poll Thing instantly goes into error when selecting Serial Slave as Parent Bridge and saving.

I do have to configure modbus in the following order, do I?:

  • Create Modbus Serial Slave (Bridge) with ttyUSB1
  • Create Regular Poll Thing (Bridge) with Modbus Serial Slave as Parent Bridge
  • Create Modbus Data Thing with Regular Poll as Parent Bridge

Or is this the wrong way to go?

Not really see anything right now you sure you have + and - correct? Then the id of the device ? Then the right registers ?

Yeah, it seems I was on the right track. I got it working by tweaking the openhab service options under

I had to change

EXTRA_JAVA_OPTS="-Xms192m -Xmx320m"


EXTRA_JAVA_OPTS="-Xms192m -Xmx320m"

where ttyUSB1 is the rs485 converter plugged into usb (dmesg shows the exact device)

Openhab error logs threw alot of these:

Could not get port identifier, maybe insufficient permissions. null

Which gave me the correct search keywords for google.

Now, the Serial Slave, Regular Poll and Modbus Data Things work together and values can be retrieved. The rest is experimenting to get length and register right. I see the light.

This made me lose my mind and I cannot even comprehend what the problem was exactly. But apparently, this must be made to even use modbus in certain constellations like mine.

Thanks for your help and your time. People responding to my threads with their ideas give me hope and kept me from just abandoning this. :joy:

I know sometimes you just need some small push to keep trying