I’am trying to connect an Teensy 3.2 Arduino to my Openhab 2.2 using the serial binding. Most of the time the comunication works perfectly, but sometimes some strange bytes are transfered.
For instance if the Teensy sends the Hex Bytes 02:02:A5:A9 the Openhab rule sometimes receives this: 02:02:EF:BF:BD:EF:BF:BD:
I already tried switching the serial binding to BASE64, but that doesn’t change anything. I also enabled debug logging but I only found the same false bytes in the log after that. I also debugged the serial port using the ssterm python tool (which can display hex values) and there I never saw such strange bytes.
So I Googled those strange bytes and found out that EF:BF:BD has something to do with UTF-8. Does anyone have an idea why those bytes are set by the serial binding?
By the way, this is how I’am getting the bytes in the rule:
var byte statusBytes = DatatypeConverter::parseBase64Binary(status)
Hi, thanks for the link. I did not change anything in the official repository yet. I first would like to discuss if this should be customizable or not. Also I’am waiting for this issue to be merged first. But I could provide you the modified addon if you like.
Everything got packed away whilst I was building and the house is still a mess so it may take me some time to get things set back up after locating them. I will see if I can find the other person that posted with an issue a few weeks ago to see if they can test it for you.
Also please don’t forget to update the documentation to let people know the feature exists should it get merged.
Hi @matt and @TheNetStriker,
I tried the new binding copying the file in the addons folder (after I had uninstalled the previous version).
When I edit the item file I can see the following entries in the log file:
2018-04-13 23:53:05.244 [DEBUG] [inding.serial.internal.SerialBinding] - Port: /dev/ttyUSB0
2018-04-13 23:53:05.245 [DEBUG] [inding.serial.internal.SerialBinding] - Baud rate: 9600
2018-04-13 23:53:05.247 [DEBUG] [binding.serial.internal.SerialDevice] - Serial port ‘/dev/ttyUSB0’ charset ‘null’ set.
2018-04-13 23:53:05.260 [DEBUG] [binding.serial.internal.SerialDevice] - Serial port ‘/dev/ttyUSB0’ has been found.
2018-04-13 23:53:05.269 [DEBUG] [inding.serial.internal.SerialBinding] - Port: /dev/ttyUSB0
2018-04-13 23:53:05.270 [DEBUG] [inding.serial.internal.SerialBinding] - Baud rate: 9600
then via Karaf console I tried to send a command to the item, but as before I don’t get any data back, and the log is:
2018-04-13 23:53:44.708 [DEBUG] [binding.serial.internal.SerialDevice] - Writing ‘POWR0 \r’ to serial port /dev/ttyUSB0
I will reply to try and help narrow down the issue in your thread that I linked to 3 posts above. Please keep discussion about your problem in your thread in case it is not related to the original subject of this thread.