Statistics for specific time in range
-
I would like to gather some statistics on temperature readings over time. I know when I select a range, I can use maPointStatistics to get the average over the range, min, max, etc.. I'm trying to see if there's a way to (easily) get average day temperatures and average night temperatures of said date range rather than just the overall average.
For example, I want to set the date bar range to 1 week and I would like to display overall average temperature, average night temperature between 6pm and 6am, and average day temperature between 6am and 6pm.
Even better would be if I could set the time range using sunrise and sunset, but I expect that would get very complicated.
Is what I'm attempting possible out-of-the-box or are we back into custom directives?
-
@tomatopi this is possible out of the box but it wont be as simple as using the datebar in the top corner. You will need to create a statistics query for each individual time span , one for day time, one for night time of each day.
-
@CraigWeb Dang. That makes it much less convenient.
Another approach I was thinking was to somehow create a data point that ran every day that would store an average value based on criteria. So one for day average, one for night average, etc. The advantage would be that it would be easy to visualize any range via the date bar in a bar graph. Does this seem like a scenario that would be plausible?
-
@tomatopi This is a good solution, definitely worth investigating. You could also reach out to a weather API and get sun rise and set times for your area and use those times in your statistics query.
-
@CraigWeb That's a good re-assurance I'm on the right train of though.
It would be neat if there was a data point that could capture sunrise and sunset for a given location. Changes in those values would trigger a context change and update the statistical point. Sunrise and Sunset values would be great if they could be used in the advanced scheduler, too, as one could save energy by using those values to trigger events like setpoints and the like.
I was hoping to use the envcands Environment Canada module to capture weather data and perhaps sunrise/sunset, but I never managed to make it work. There's a distinct lack of documentation on that module. If there is documentation, that would be extremely useful.