Serial binding with RegEx not working

Hi all,

I am running the latest OpenHab online.

Have an issue with the Serial binding. I keep getting this error:
14:03:32.984 [ERROR] [binding.serial.internal.SerialDevice] - No transformation service available!

The corresponding Item line is:
String data2 "energy kwh: [%s]" (GF_Living) {serial="/dev/ttyUSB0@115200,REGEX(.*1-0:1\\.7\\.255\\*255\\((.*)\\*W.*)"}

And yes I have added the RegEx service to addons.cfg. Habmin and PaperUI both say it’s installed. With simpler RegEx statements it also gives the same error so that cannot be it.

Does anyone have any clues on how to solve this?

Best regards,

Mario

Just faced the same issue.
Any advice?

In the end I made a rule that triggered on update of a string variable
bound to the serial port. Then with the RegEx class of Java I extracted the
data I wanted. The REGEX transformation didn’t work for me.

Could you please share an example? I’ve tried the same without success so far.

EDIT:
just got it working.
This is the sample string received from the serial port:

20;86;LaCrosse;ID=0400;TEMP=000e;

And this is the rule to grab the temperature:

rule "RFLink"
when
    Item RFLinkRaw received update
then
    logInfo("RFLink", "raw data received: " + RFLinkRaw.state)
    var String tempHex = transform("REGEX", ".*;LaCrosse;ID=0400;TEMP=([0-9a-f]{4});", RFLinkRaw.state.toString)
    logInfo("RFLink", "data parced: " + tempHex)
end

Still have a small problem. Sometimes I’m getting the different strings on input [radio signals coming from the neighbours], in this case I’m getting

data parced: null

how to avoid this?

I did the following:

// filter out the kwh
rule "KWH"
when
  Item EM_data received update
then
  var Pattern pattern
  var Matcher matcher
  var Double  value

  pattern = Pattern::compile (".*1.8.1\\((.*)\\*kWh\\).*")
  matcher = pattern.matcher(EM_data.state.toString())
  if(matcher.find())
  {
    value = Double::parseDouble (matcher.group(1));
    postUpdate (meter_tariff1_kWH,value);
  }

You can test for (null) to avoid the situation you have.

Thank you for the example.
I will probably need to put some if-then logic at the beginning to filter for my own source names.

@sourceror Mario, which version you’re currently on?
I’ve faced a problem with the serial binding in general, have you seen anything similar (assuming you’re on RC1)?

I’m on the latest build. Works pretty stable.