Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102800

Formula based statistics graph

$
0
0

Hi there!
I’m diving into the rabbit hole of long term statistics, and came across quite a specific problem:
I would like to see statistics on the dominant wind direction in a given time window. Since we are talking compass headings where 359° and 1° are separated by 2° and not 358°, I cannot use a simple average of the compass heading. The average for the above example is obviously 0° (North), but a normal average would give the opposite result, 180° (South)

The solution for this is to have template sensors that log the sine and cosine of the wind direction, averaging those over time, and performing an arctan of the averages to get the average wind direction. This is discussed in this thread in detail: Filter wind direction - #13 by Kimble8650

However, when using long term statistics, the solution would be similar - I log the statistics of the sine and cosine of the wind direction, but in order to display the average wind direction I would need to, at the time of rendering, calculate the arctan based on the sine and cosine statistics.

Is there a way for me to do this, to display a statistics graph based on a calculation of two separate statistics?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 102800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>