Serial Binding HEX

Hi
I would like to receive and send HEX to a Serial RS485 (Dynalite)

But when I send a Hex code from the RS485 Dynet to OH2 1C,15,64,00,00,00,FF,6C
OH2 receives this code

12:45.538 [INFO ] [marthome.event.ItemStateChangedEvent] - 232 changed from NULL to d�l

Is there a way I can receive the same HEX as I send?

As well as a way how I send HEX code, I have tryed with \u00xx\u000x\u00xx\u000xx but can’t see how to write it in to this code.

My Item ltem like this.

String 232 {serial="/dev/ttyUSB1@9600"}

Try with BASE64.

Item:

String Hydrogen_Peroxide_Sensor {serial="/dev/ttyPort2@9600,BASE64"}

Then in my rule:

sendCommand(Hydrogen_Peroxide_Sensor, '\u0055')

Note: I have been having issues with BASE64 with openHAB 2.1, I am using the older org.openhab.binding.serial-1.10.0-SNAPSHOT.jar binding.

HI

No change with BASE64, what should it do?

String 232 {serial="/dev/ttyUSB1@9600,BASE64"}

My Serial Binding info

234 | Active    |  80 | 1.10.0.201706261321    | openHAB Serial Binding

And OH2 info

openHAB 2.1.0~20170608174511-1 (Build #941)

I had to downgrade:

181 | Active | 80 | 1.10.0.201702161311 | openHAB Serial Binding

What do the logs say? I like to break things up into individual log files such as:

# serial logger
log4j.logger.org.openhab.binding.serial = DEBUG, serial, osgi:*
log4j.additivity.org.openhab.binding.serial = false
log4j.appender.serial=org.apache.log4j.RollingFileAppender
log4j.appender.serial.layout=org.apache.log4j.PatternLayout
log4j.appender.serial.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c{1}] - %m%n
log4j.appender.serial.file=${openhab.logdir}/serial.log
log4j.appender.serial.append=true
log4j.appender.serial.maxFileSize=1000MB
log4j.appender.serial.maxBackupIndex=10

In /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg

I don’t think so, at least not in the logs, I know mine is a mess:

2017-07-03 15:42:01.690 [SerialDevice              ] - Writing 'T' to serial port /dev/ttyPort1
2017-07-03 15:42:01.798 [SerialDevice              ] - Received message '' on serial port /dev/ttyPort2
2017-07-03 15:42:01.898 [SerialDevice              ] - Received message '
' on serial port /dev/ttyPort5lDevice              ] - Received message '7.629
2017-07-03 15:42:02.464 [SerialDevice              ] - Received message 'BM
' on serial port /dev/ttyPort4lDevice              ] - Received message '651.4
2017-07-03 15:42:03.303 [SerialDevice              ] - Received message 'BM
2017-07-03 15:42:04.142 [SerialDevice              ] - Received message 'BM
2017-07-03 15:42:04.982 [SerialDevice              ] - Received message 'BM
2017-07-03 15:42:05.821 [SerialDevice              ] - Received message 'BM
2017-07-03 15:42:06.661 [SerialDevice              ] - Received message 'BM
2017-07-03 15:42:07.501 [SerialDevice              ] - Received message 'BM

	��
2017-07-03 15:42:08.340 [SerialDevice              ] - Received message 'BM

	��
2017-07-03 15:42:09.178 [SerialDevice              ] - Received message 'BM

	��

Not sure if it helps, but this is how I parse my responses:

rule "Hydrogen_Peroxide_Sensor"
when
  Item Hydrogen_Peroxide_Sensor received update
then
  val to64 = DatatypeConverter::parseBase64Binary(Hydrogen_Peroxide_Sensor.state.toString)
  val ByteBuffer bb = ByteBuffer::wrap(to64)
  if (bb.array.size >= 2) {
    val double distance = (24 - (bb.getShort * 0.0393701))
    val double gallons = ((3.14159 * (7 * 7) * distance) / 231)
    if (gallons >0 && gallons <15) {
      postUpdate(Hydrogen_Peroxide, gallons)
      if (gallons < 4 && Hydrogen_Peroxide_Low.state == OFF) {
        //sendCommand(Hydrogen_Peroxide_Low, ON)
      } else if (Hydrogen_Peroxide_Low.state == ON) {
        postUpdate(Hydrogen_Peroxide_Low, OFF)
      }
    }
  }
end

And:

rule "Outside_Air_Sensor"
when
  Item Outside_Air_Sensor changed
then
try {
  val to64 = DatatypeConverter::parseBase64Binary(Outside_Air_Sensor.state.toString)
  val ByteBuffer bb = ByteBuffer::wrap(to64)
  val short start = bb.getShort
  val short length = bb.getShort
  if (start==16973 && length==28) {
    val short pm1 = bb.getShort
    if (pm1>0) {
      postUpdate(Outside_PM1, pm1.toString) 
    }
    val short pm25 = bb.getShort
    if (pm25>0) {
      postUpdate(Outside_PM25, pm25.toString) 
    }
    val short pm10 = bb.getShort
    if (pm10>0) {
      postUpdate(Outside_PM10, pm10.toString)
    }
  }
}
    catch(Exception e) {
        logError("outside air", "Exception in rule 'Outside_Air_Sensor': " + e.toString)
    }
end