Posted Thu, 01 Jan 2015 06:00:00 GMT by Portal Admin

Q. I am writing a custom probe for a device that reports, among other things, the measured temperature as a STRING, for example: "74 deg". How can the probe use this result in a threshold comparison for lower and upper temperature boundaries?

A. You should be able to retrieve it as a string, and then extract the value as a calculation. It would look something like this:

rtemperature, , STRING, "Temperature text"
ftemperature, substr(${rtemperature}, 0, -4), CALCULATION, "Temperature value"

This extracts just the number; everything from the beginning, up to four letters before the end (space, d, e, g).

Once the text is removed from the end, it should be treated as an integer later on, in threshold calculations.

You must be signed in to post in this forum.