marting
3 months agoNeophyte
Complex Datapoints - Nested if / elseif possible w/o scripting?
Setting up some monitoring for an HVAC device and there is a request to track / alert on the current state/mode of HVAC zones (i.e. when they're not at the expected state). There is an HTTP interfac...
- 3 months ago
Groovy can't access the normal datapoints, but it has the output of the script. So you could use Groovy to loop through all the lines, splitting on the ":" and grabbing the datapoint name and value into a map.
Nested if statements are definitely possible. Most likely there's a problem with opening/closing parenthesis.
However, I wonder if you can do this with a script pretty easily.
statusMap = [ "Heat": 1, "Cool": 2, "Vent": 3, "On Fire": 4, "This is OK": 5, "Batman riding an elephant": 6, "Day after tomorrow": 7 ] data = new URL("https://myACunit/metrics").getText() value = data.tokenize(":")[1] println("mode: ${statusMap[value]")
Then you'd only have one datapoint and that one datapoint would have an integer value depending on the mode returned.