This page last changed on Jun 09, 2014 by mjm.

Hi all,

I'm pretty new to OpenRemote and could use some help with finding the proper regexp to use to extract a float value and show it as a sensor value. I've hit a wall with this.

The sensor in question is an Aeon Labs Multisensor. I want to read out the temperature value. The Z-Wave controller is a Razberry on a Raspberry. I've activated the Openremote helper functions. Everything works fine if the value returned is an integer (say 26). But if the value is a float (say 26.2) the UI shows "N/A".

I thought this might be solved by a regexp:

([-+]?[0-9]*\.?[0-9]+)

This regexp matches both the integer and float variants (test with http://java-regex-tester.appspot.com). But whatever I do, the float value is not parsed.

For those interested: the calls to the Z-wave controller are http calls (like: http://servername:8083/ZAutomation/OpenRemote/TemperatureLevel/4). These calls return a plain value, no quotes, text whatever (say: 26.2).

I even tried JSONPath instead (I used $ for the root element). No luck.

Any ideas?

TIA

Marcel

Use a plain Custom Sensor. Leave the signal translation section on the lower part of custom sensor empty. Works for me in the display of room temperatures. Has worked for me across the versions
Right now I do use RaZberry 1.7.0, with today's "develop" branch from GIT.

Posted by pz1 at Jun 09, 2014 18:08

It's amazing. It works! Thx.

I thought I'd tried that but apparently not, or I messed up something else. Still makes me wonder what the correct use of regexp is.

For future reference:

  • create a command that fetches the (float) value
  • create a custom sensor that uses this command. Leave "custom state items" empty.
  • create a label in the UI that uses the sensor

Done!

Posted by mjm at Jun 09, 2014 21:17
Document generated by Confluence on Jun 05, 2016 09:37