0

these are the write commands towards a serial port:

sendCommand(SendCOM3,"hallo\r\r") --- text format

sendCommand(SendCOM4,"\u0001\u0012\u0123\u000F\r\r") --- binary format

and works fine.

Now, who can tell me what I have to do to get the response message over the same serial port ?

Thanks Ciao marco

marco_m
  • 16
  • 1
  • 3

2 Answers2

1

Since you're already writing to the port, I'm assuming you have the serial binding as an addon and the serial ports enabled.

Create a new item and bind it to the serial port to assign incoming data. For example,

String Hallo1 "Hallo [%s]" (hall0) {serial="SendCOM3"}

The data is a string that you'll need to parse. Restart OpenHAB, check the logs and you should see your item updated.

swmcdonnell
  • 1,381
  • 9
  • 22
0

Add serial binding .jar file to your addons directory

org.openhab.binding.serial-1.7.1.jar

And add item to yourschema.items:

String MySerialDevice "MySerialDevice [%s]" { serial="/dev/ttyUSB0" }

change ttyUSB0 to your real tty serial device.

Gondy
  • 4,925
  • 4
  • 40
  • 46