Sure, thank you for the reply:
I am trying to setup some alerting. i have a sensor that measures vibration in three axes, with three values (min/max/rms) for each. The sensor also returns a temperature measurement. This gives me 10 measurements onto which I would like to set a threshold, so when they go above, I will generate an alert.
I would also like to (in the future) set a minimum threshold, to generate an alert. However that would mean 20 thresholds to maintain per device.
What is the payload path of the string you want to assess?
I am not sure if this is the right way to set a threshold for alerting, but I decided to try a ‘Device Tag’ with a key of ‘temp_f_threshold’ and a value of ‘100’.
My workflow triggers on Device State receive. It looks at the deviceTags, and since there are many, I begin looping through them. Since my device has non- threshold related tags, (like recipe, location, Experience Access groups,etc) I need a way to look at the name of the tag, and see if it contains ‘_threshold’ and if it does, I know that will be a threshold value to use in my workflow.
What value are checking for?
I imagine a device with several tags that are _threshold.
If I split on _threshold, to tell if it has threshold in the name, then split on the _ I should end up with
(0) - temp_f
(1) - threshold
I can use the 0th value to determine which property this threshold applies to, in this case the min_x measurement, and then use a math to check if the min_x measurement on this payload is > or < (in the future I may need to tag this as temp_f_threshold_greaterthan)
What is your desired output - do you only need to know if the value is present (i.e. True/False) or do you need to store the value for later use?
If we are talking about whether the string contains the string, Yes, desired output is True or False.
If I could iterate through the keys, and string search, I feel like I could make a workflow that finds all of the _threshold tags, splits them to determine the attribute they are thresholding against, and then still within that loop, make the comparison and raise an alert if the condition is > threshold.
In typing this up, I wonder if I could instead use a datatable with columns for:
deviceId, attribute, evaluation, threshold
And instead, loop through each payload attribute sent, and compare it to the values in the data table?