Hi,
I’m running the MQTT binding in OH4 and I am trying to make use of the REGEX binding as well
I have following stated under the “Incoming Value Transformations” in the MQTT generic item:
REGEX:(?<=1-0:31.7.0\(0)(.*)(?=\*A\)\\r\\n1-0:5)
But why is this not working when I am trying to transform an incoming MQTT string and capture 5.5 from the the paramter 1-0:31.7.0 in the string below?
/ELL5\\253941227_A\r\n\r\n0-0:1.0.0(230903100128W)\r\n1-0:1.8.0(00002557.779*kWh)\r\n1-0:2.8.0(00000000.162*kWh)\r\n1-0:3.8.0(00000730.106*kvarh)\r\n1-0:4.8.0(00000005.070*kvarh)\r\n1-0:1.7.0(0000.116*kW)\r\n1-0:2.7.0(0000.000*kW)\r\n1-0:3.7.0(0000.069*kvar)\r\n1-0:4.7.0(0000.050*kvar)\r\n1-0:21.7.0(0000.010*kW)\r\n1-0:41.7.0(0000.007*kW)\r\n1-0:61.7.0(0000.098*kW)\r\n1-0:22.7.0(0000.000*kW)\r\n1-0:42.7.0(0000.000*kW)\r\n1-0:62.7.0(0000.000*kW)\r\n1-0:23.7.0(0000.000*kvar)\r\n1-0:43.7.0(0000.000*kvar)\r\n1-0:63.7.0(0000.069*kvar)\r\n1-0:24.7.0(0000.014*kvar)\r\n1-0:44.7.0(0000.035*kvar)\r\n1-0:64.7.0(0000.000*kvar)\r\n1-0:32.7.0(241.2*V)\r\n1-0:52.7.0(241.0*V)\r\n1-0:72.7.0(241.1*V)\r\n1-0:31.7.0(005.5*A)\r\n1-0:51.7.0(000.1*A)\r\n1-0:71.7.0(000.5*A)\r\n!41FB\r\n
Side note, I am not sure if the “\n” and “\r” are being processed by the REGEX transformation. If I look at the item in the UI there are no “\n” or “\r”, but if I check the item via the REST API it is shown as above. But I have tried my REGEX statement with and without the extra characters and still get the same result.
Example:
Help appreciated.