I have a process where I measure 2 temperatures.
The interesting measurement is the difference of those temperatures.
But it’s only interesting if the temperature is above 100 F.
How do I best approach only trending/averaging the temp diff when it’s above 100 F.
A workflow adding a calculated value to the payload if temp is above 100?
I would recommend another attribute on the device to store the difference values. A workflow would then be used to calculate and report the difference only if the value is greater than 100.
Would you store away the “daily”, Weekly, Monthly averages in a attribute too, or a table?
How would I best go back in time and record this calculated average , for example, per day, to a new attribute?
I wouldn’t store aggregations, because if they’re saved on device attributes, you can generally calculate those at any time using the Gauge and Time Series dashboard blocks and workflow nodes.
Going back in time and re-calculating those is not something you’ll be able to do within the platform itself. If I had to approach that problem, I’d export the device data and then use a Node script to calculate the new value and record it back on the device. If you record a new attribute on the exact same millisecond as an existing data point, the platform will essentially merge those together into a single device state.
The script itself would work fairly similar to the CSV Import script, except you’d store a calculated value instead of what was in the CSV itself.