
I've been puzzling over the data I observe via the API comparing with a seperate energy monitor, which I am trying to correlate.
The following test is easily reproducable.
I have an electric fan which has been adjusted to consume 18 watts at a specific speed setting.
The fan is switched on at 7am for exactly a minute.
Then a pause of exactly a minute.
This is repeated as accurately as possible so that there are 4 times the fan is on.
I have some code that summarises the datapoints returned by the API for a given timespan.
What I expect to see (give or take a couple of seconds at most) is something like this:
Device <PlugE>
From <2023-10-01T06:00Z> to <2023-10-01T07:07:00+01:00>
2023-10-01T06:00:00Z 18.0 watts for 60 seconds 1080.00 watt-seconds ( 1080.00 accumulated)
2023-10-01T06:01:00Z 0.0 watts for 60 seconds 0.00 watt-seconds ( 1080.00 accumulated)
2023-10-01T06:02:00Z 18.0 watts for 60 seconds 1080.00 watt-seconds ( 2160.00 accumulated)
2023-10-01T06:03:00Z 0.0 watts for 60 seconds 0.00 watt-seconds ( 2160.00 accumulated)
2023-10-01T06:04:00Z 18.0 watts for 60 seconds 1080.00 watt-seconds ( 3240.00 accumulated)
2023-10-01T06:05:00Z 0.0 watts for 60 seconds 0.00 watt-seconds ( 3240.00 accumulated)
2023-10-01T06:06:00Z 18.0 watts for 60 seconds 1080.00 watt-seconds ( 4320.00 accumulated)
Thus 18 watts consumption for 4 minutes
However I observe from the API has very dubious timing accuracy:
Device <PlugE>
From <2023-10-01T06:00Z> to <2023-10-01T07:07:00+01:00>
2023-10-01T06:00:33Z 18.1 watts for 29 seconds 524.90 watt-seconds ( 524.90 accumulated)
2023-10-01T06:01:02Z 0.0 watts for 89 seconds 0.00 watt-seconds ( 524.90 accumulated)
2023-10-01T06:02:31Z 18.0 watts for 33 seconds 594.00 watt-seconds ( 1118.90 accumulated)
2023-10-01T06:03:04Z 0.0 watts for 88 seconds 0.00 watt-seconds ( 1118.90 accumulated)
2023-10-01T06:04:32Z 18.1 watts for 31 seconds 561.10 watt-seconds ( 1680.00 accumulated)
2023-10-01T06:05:03Z 0.0 watts for 91 seconds 0.00 watt-seconds ( 1680.00 accumulated)
2023-10-01T06:06:34Z 17.9 watts for 27 seconds 483.30 watt-seconds ( 2163.30 accumulated)
I'm happy enough the wattage reading is fine, but the accumulated consumption calculation is way off because the observed timestamps are nothing like 60 seconds apart. If anyone is interested and perhaps can shed some light, the raw data is as follows:
{
"data": [
{
"time": "2023-10-01T06:07:01Z",
"power": 0
},
{
"time": "2023-10-01T06:06:34Z",
"power": 17.9
},
{
"time": "2023-10-01T06:05:03Z",
"power": 0
},
{
"time": "2023-10-01T06:04:32Z",
"power": 18.1
},
{
"time": "2023-10-01T06:03:04Z",
"power": 0
},
{
"time": "2023-10-01T06:02:31Z",
"power": 18
},
{
"time": "2023-10-01T06:01:02Z",
"power": 0
},
{
"time": "2023-10-01T06:00:33Z",
"power": 18.1
},
{
"time": "2023-10-01T05:59:06Z",
"power": 0
},
etc...
Thoughts anyone?
