Aggregate Device Data

I am trying to determine the Min, Max, Average, Mean, and Range of a data element from a group of sensors. I can wrap my head around how to approach this. The data comes in from the sensors (devices) every 15 minutes. I would like to take the data that was reported at a particular interval and generate these metrics. Any ideas?

Are you trying to present these values on a dashboard, or use them within a workflow?

Ideally on a dashboard time series. For these sensors it is the variance that matters more than the discrete values.

The time series Block makes it really easy to aggregate (mean, min, max, count, sum…but no average!..bummer) for multiple readings taken within an interval for a single Device. I want to be able to run some simple calculations for a time interval across multiple Devices. For example, show me (plot on a time series) the Variance of a Group of Devices every 20 minutes.

Is such a thing ‘possible’ within Losant?

As far as I know “mean” and “average” are synonymous. Let me know if that’s not the case, and also drop me a link for how to calculate one vs. the other.

Graphing the variance between two devices is not currently possible, but an interesting concept. There’s no reason why a series on the time series graph couldn’t be a calculation of two other series. Will brainstorm on this internally.

A workaround for now will be to record the variance of two devices onto a third virtual device, which can then be graphed.

Oops…you are correct. Thanks for being gracious as my elementary school Median/Mean/Average recall failed me!

In my case I need to be able to find the variance, mean, min, and max for a ‘cluster’ of as many as 8 co-located devices. I can ‘see’ it when I look at the data, but currently can’t figure out how to, for example, generate a notification when the deviations are large.

I would probably recommend a variance virtual device to store this information. This can be done in a workflow. Whenever the 8 devices have all reported state, you can then record variance values for each combination of devices on another device using the Device State node.

You can then trigger another workflow whenever the variance device receives state. Inside this workflow you can make alerting decisions based on the recorded data.

With all the variances stored on a device, you can then easily graph them on a dashboard like any other device data.

It working! I ended up using a slightly different approach. I created a device called ‘Site’ representing a collection of sensors (devices). I used a Timer as a trigger. I set up the chron job to trigger after I knew all the sensors would have reported in. Then I used the Data:Time Series to aggregate various values (for example, Mean, Max, Min, etc.) from a collection of sensors. The value was then used to set the Device State value for the Site.

Make sense? Thoughts?

image

How are you liking Losant?

Are you reporting data from 8 different retail locations like you were working on over on the Particle forum?

I have a similar issue with aggregating device data, specifically within a time-series dashboard block.

I want to see the sum of two means, from different devices. This is possible within an indicator block: you have two separate queries, with aggregation set to ‘Mean’, then add the queries together using the dashboard label (eg, {{format (add (divide value-0 1000) (divide value-1 1000))‘.1f’}} kW )

Then I wanted to see this data as a time series. Within this block, you can aggregate data from multiple devices, as either ‘sum’ or ‘mean’, etc.
When set to ‘mean’, it takes an average of the values from the two devices, which isn’t what I want to show.
When set to ‘sum’, it kind of works if your resolution is set to the same time interval as the device state updates, but if these don’t match up, the data will look completely different to what’s in the indicator block.

I’m sure there’s ways to do this within the workflow, but a ‘mean-sum’ aggregation option within the time-series block would solve this problem for me.