Reputation: 16
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
Upvotes: 0
Views: 3004
Reputation: 5295
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.
Upvotes: 0
Reputation: 1421
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.
Upvotes: 1