jSon Tranformation inside of MQTT configuration 2.5

I have been receiving this message from sonoffbridge (rf signal), but I would like to have a transformation for open/close but for specific bold area only. How to split this using json

tele/sonoffbridge1/RESULT = {“Time”:“2020-01-21T04:11:02”,“RfRaw”:{“Data”:“AA B1 03 0212 03FC 2D28 0010110011010010101010101011010100101100101100101011001102 55”}}

IMHO regarding JSON only the whole string after “data” (“AA …”) is adresable via JSON. In order to split that string further down you would need to split that string. I would think a simple .contains("theBoldPart") method should do.

1 Like

Use a REGEX transformation instead. Just make sure to build an expression that matches the full string and put the binary sequence in parens.

The REGEX will filter out any message that doesn’t have that sequence and the custom

I was trying to build a more generic REGEX @rlkoshak. So i could get all devices in my house that use the same rf pattern. Tried doing:

(?<=^…)[0-2]{58}

  1. start at beginning;
  2. skip AA B1 03 0212 03FC 2D28
  3. Get the 58 characters i need.

The thing is, using this regex i use a lookbehindmethod, which is not supported.
Also, how can i use the REGEX with JSON in the paperUI thing configuration?

Any clue?

MQTT is one of very few (well, only so far) bindings that support transform chaining
It’s in the MQTT docs

That REGEX does not match the whole string and the part you want is not in the capture group. Whether or not you want a more generic REGEX, those are the requirements for using REGEX transformation in openHAB.