Appreciate your thoughts and feedback @jefflayman ! I like the analysis you are doing on your “Always On” devices given the limited window we have into their behaviors. Sense does a great job simplifying how we look at them and their usage, but sometimes it is fun to peel back the layers.
Your “Poor Man’s Histogram” is great ! Seems like you are getting a very useful view out of yours - baseline plus range of typical power usage. Nice being able to correlate baseline usage with Always On for the printer. The real trick is picking the bin size / number correctly to reveal behaviors. Excel’s histogram capabilities surprised me the other day - I tried the histogram function on some of my data the other day and it auto-selected 7 bins, instead of the 24-30 I had been using (30 is the ggplot2 default, 24 is the hours in a day, but an hour is a very arbitrary unit if a behavior/distritbution isn’t tied tightly to a clock). 7 bins worked much better in telling me what was going on, than 24 or 30.
Kasa readings, and all typical AC power, current and voltage measurements have to be “area under the curve” measurements due to the nature of AC. I’m going borrow some “Theory of Operation” from the MAX71020 spec sheet - that’s the measurement chip inside the HS110.
The energy delivered by a power source into a load can be expressed as :
That’s the area under the instantaneous Voltage (V) x Current (I) curve. A modern solid-state electricity meter IC such as the MAX71020 functions by emulating the integral operation above, i.e., it processes current and voltage samples through an ADC (Analog Digital Converter) at a constant frequency. As long as the ADC resolution is high enough and the sample frequency is beyond the harmonic range of interest, the current and voltage samples, multiplied with the time period of sampling yield an accurate quantity for the instantaneous energy. Summing the instantaneous energy quantities over time provides very accurate results for accumulated energy.
The following chart highlights why AC measurements use area under the curve. It shows sampled data for a simple resistive load at 50Hz (60Hz period would be 16.66667 ms).
The above figure shows the shapes of V(t), I(t), the instantaneous power and the accumulated energy resulting from 50 samples of the voltage and current signals over a period of 20ms. The application of 240V AC and 100A results in an accumulation of 480Ws (= 0.133Wh) over the 20ms period, as indicated by the accumulated power curve. The described sampling method works reliably, even in the presence of dynamic phase shift and harmonic distortion. After a sufficient number (typically 2520) of multiplexer frames have been collected, the MAX71020 issues an interrupt to the host using the INTZ pin, signalling that new energy values are available.
Basically, in default operation the MAX71020 delivers a new “under-the-curve” accumulated RMS power reading every second (2520 samples / 2520.6 samples per second).
When Sense or Duane’s utility sends out a broadcast asking all the HS110s on the local network for their “emeter” data, all those Kasa’s respond with the ASCII packet below. I emphasize ASCII because that implies that the HS110 does a bunch of stuff in the middle related to calibration, scaling and converting the data from binary to decimal.
{"emeter":{"get_realtime":{"current":0.028915,"voltage":120.798141, "power":0.527563,"total":18.045000,"err_code":0}}}}