After two days of fighting, I will ask you for help.
It reads the data from the energy meter through the usb adapter connected to the RPi. They use a python script to read register values. The problem arises when I want to read data through Openhab.
more explanation would help to figure what you want. First are you able to connect or not ? second its normal that your item display a decimal because of this [%.1f V]. What are you expecting to receive as value if what you receive is not correct ?
2022-09-28 11:19:19.227 [ERROR] [et.wimpi.modbus.net.SerialConnection] - open port failed: gnu.io.PortInUseException: Modbus Serial Master
2022-09-28 11:19:19.233 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - connect try 1/1 error: open port failed: Modbus Serial Master. Connection SerialConnection@53b02[portName=/dev/ttyUSB1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@12ae85e[portName=/dev/ttyUSB1]
2022-09-28 11:19:19.238 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - re-connect reached max tries 1, throwing last error: open port failed: Modbus Serial Master. Connection SerialConnection@53b02[portName=/dev/ttyUSB1,port=<null>]. Endpoint ModbusSerialSlaveEndpoint@12ae85e[portName=/dev/ttyUSB1]
2022-09-28 11:19:19.242 [ERROR] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection SerialConnection@53b02[portName=/dev/ttyUSB1,port=<null>] for endpoint ModbusSerialSlaveEndpoint@12ae85e[portName=/dev/ttyUSB1]: open port failed: Modbus Serial Master
2022-09-28 11:19:19.249 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusSerialSlaveEndpoint@12ae85e[portName=/dev/ttyUSB1] -- aborting request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1b54382[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=512,length=3,maxTries=3] [operation ID bad6bba6-1bb2-449d-a53f-38e74d6ded9b]
I have one more idea. Maybe the problem is Modbus Binding. In OH 2.5, I installed it by copying it to /user/share/openhab2/addons/ from 2.5.0 and I’m not sure if it’s correct.
Could someone please share the files from the newer version with me?
Now I added such because I did not find others.
org.openhab.binding.modbus-2.5.0-SNAPSHOT.jar
org.openhab.io.transport.modbus-2.5.0-SNAPSHOT.jar
are planning on staying on 2.5 or upgrade to 3 openhab? for openhab 3 depending on your choise of install enviroment you can see here https://www.openhab.org/docs/administration/serial.html
if you plan on staying on 2.5 afraid the new binding will not work on 2.5 so you have to follow this link for configuration https://v2.openhab.org/addons/bindings/modbus/
Now if you can post more details of the device that you want to connect to like registers id baud. The manual of that device will help establish if you are using the correct parameters to connect to it.
Sometimes the polarity of the data wires can be wrong also and you dont get anything.
Post as much information as you can about your setup to get more help
I plan to stay at OH 2.5. I can’t find these files anywhere to install the new binding modbus:
org.openhab.binding.modbus-2.5.12.jar
org.openhab.io.transport.modbus-2.5.12.jar
The connections to the adapter are correct because I can read the data from the meter via the phyton script.
At hex 0x200, there is voltage on L1. Here is the modbus documentation from the energy meter that I’m trying to connect to: LINK
I tried to reinstall bindings modbus version 2.5.0 but I have this error:
2022-09-28 12:52:28.585 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-modbus': Error:
Resource mvn:org.openhab.addons.bundles/org.openhab.io.transport.modbus/2.5.0 does not contain a manifest
Resource mvn:org.apache.commons/commons-pool2/2.4.3 does not contain a manifest
2022-09-28 13:18:28.569 [ERROR] [core.karaf.internal.FeatureInstaller] - Failed installing 'openhab-binding-modbus': Error:
Resource mvn:org.apache.commons/commons-pool2/2.4.3 does not contain a manifest
Resource mvn:org.openhab.addons.bundles/org.openhab.io.transport.modbus/2.5.0 does not contain a manifest
I was able to run Modbus reading in Openhab. Installing the missing stuff from the kar file helped. I can already read data about individual identifiers using the code:
Unfortunately, for some data only such a double code is given, e.g. 0034-0035 or 0x0E-0x0F. How to read it? When I use the code below, I get stupid things.