Just for fun, I decided to implement a version of the Sense Always On calculator using Home Assistant w Grafana. The panel on the left shows a histogram of Total Usage over a 48 hour period, the sampling period used by Always On. The panel on the right shows the smallest values from the past 48 hours, from smallest to larger. In my case, I’m only getting a sample every 2 minutes (vs Sense’s every 1/2 second) so I should only have 1440 samples over the past 48 hours. Sense uses the 1% bin for Always On, so I need to select the 14th smallest value as Always On (1440 x 1% = 14.4).
So my Always On is around 622W. Sense, right now, is telling me 625W.
Setting Up Grafana
I’m not going to outline how to link Grafana/InfluxDB to Home Assistant, or how to set up Home Assistant with the Sense integration. All of that is fairly well explained in the Home Assistant documentation. But I will share a few details about using Grafana to set up this particular dashboard.
The first thing to do is create a new dashboard in Grafana. Once you do that, you’ll need to write a query to pull the Total Usage data out of the InfluxDB database for the histogram. Here’s the setup I’m using. Note that I am asking for a max of 2880 datapoints since I thought that the Home Assistant Sense integration was sampling Sense data every 60 seconds (2880 is the number of minutes in 48 hours). Please note that I have already set the Time Filter at the upper right of the dashboard to 2 days (48 hours),
I then hit the “Inspect Query” button to se what data was actually pulled. To my surprise, I’m only getting 1421 data points.
When I look at the data in the table view, I see that the data is retrieved/sampled every two minutes. I’ll need to investigate my assumption about Sense / HA sampling, but for now I’ll accept that I have samples for every 2 minutes minus a few missed ones (1421 vs 1440 if sampled every 2 minutes)
You’ll also notice that I have set the type of chart to a Histogram and have set the Bucket size to 200W.
To get the list of values, I set up one more dashboard with the same query, but then configure as a Table and hide the Time column using an Override.
A fun use of Home Assistant and Grafana to give me something that Sense already gives me, but also provides a little more depth on how the number is arrived at.