Understanding Shelly aenergy vs apower for daily power consumption?

Use file context instead of memory? But yes, you could use the dB if you wished.

Even if the calculations were completed over a full cycle, that's just one snapshot reading covering 1/60th of a second, but the remaining 9.983 seconds is ignored and do not feature in the power data calcs (if it updates every 10 seconds).

If shelly had not used the word instantaneous in their API docs, I maybe would of thought otherwise. But, I could of course be interpreting Shelly's documentation too literally, or shelly have used the wrong word :wink:

1 Like

Yes, I had assumed that. Even file context can get lost however. The machine might fail and you have to restore from backup. Presumably the db is backed up, but maybe not the context. Also if node-red were to crash it might fail at a point before where it has written the latest out to file.

I think they are using the word instantaneous to differentiate it from the accumulated energy calculated over a period. As a matter of interest, not necessarily relevant to the Shelly, the PZEM 016 that I use appears to average the current power over about three seconds. I suspect with simple, cheap hardware, the longer the averaging time the more accurate the reading is, though the less 'instantaneous' it is :slight_smile:

1 Like

Hello Guys,
thank you for all the replys - very interessting discussion.

it does not have to be a high-precision measurement - but it should be conclusive and correct

I've tried similar approaches with aenergy - but this approach seems to be very good and "easy" to implement. I will use a flat file for saving the lastReading, so that also in a "crash" case, the value will be stored anyway. This vallue will be saved in influxdb and later I try to visualize it in a grafana dashboard.

I have a good comparison if the values are "ok" - because before I've installed the shelly I had a Tasmato Plug, which gave me the "total kW/h". Let`s see what the next days will show :slight_smile:

With my pedantic hat on, it cannot be both low precision and correct. :slight_smile:

2 Likes

I've implemented the logic from above and at the first glimpse it makes sense
See here ther result from Shelly which I get. The "MomentAenergy" is my calculated value

[{"Voltage":239,"Current":0.593,"Apower":112.7,"Aenergy":8.800514,"InterneTemperatur":57.3,"MomentAenergy":0.001273}]

Lets do the math: every 20 seconds I got the values (it`s enough accuracy for me :D)

0.001273 * 4 = 0,005092 Watt/hours per Minute
0,005092 * 60 = 0,30552 Watt/hour
my office is normaly 12h open:
0,30552 * 12 = 3,666 Watt/hour

My Tasmota plugs show me for the same setting ~ 2,0 - 2,5 kW/h for 12hours.

Two Questions:

  • Where do I mixed up the units?
  • Because also in influxdb, i got strange values when I'm visualize it on Grafana

FluxQuery in Grafana for visualize the daily consumption

from(bucket: "nodered")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "büro_shelly1pm")
  |> filter(fn: (r) => r["_field"] == "MomentAenergy")
  |> aggregateWindow(every: v.windowPeriod, fn: sum, createEmpty: false)
  |> yield(name: "sum")

Sample Query from influxdb

0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:14:00Z	0.00007366666666666666	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:16:00Z	0.0008676666666666668	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:18:00Z	0.0008451666666666665	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:20:00Z	0.0008088333333333334	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:22:00Z	0.0006863333333333332	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:24:00Z	0.0007185	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:26:00Z	0.0007758333333333332	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:28:00Z	0.000693	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:30:00Z	0.0006775	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:32:00Z	0.0007803333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:34:00Z	0.0008021666666666666	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:36:00Z	0.0007681666666666667	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:38:00Z	0.0007018333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:40:00Z	0.0007031666666666667	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:42:00Z	0.0007226666666666666	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:44:00Z	0.0006569999999999999	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:46:00Z	0.0006760000000000001	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:48:00Z	0.0006951666666666667	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:50:00Z	0.0006675	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:52:00Z	0.0008093333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:54:00Z	0.0006863333333333334	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:56:00Z	0.0007403333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T06:58:00Z	0.0007138333333333334	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:00:00Z	0.0006361666666666667	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:02:00Z	0.0006311666666666666	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:04:00Z	0.0006093333333333334	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:06:00Z	0.0008231666666666668	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:08:00Z	0.0008141666666666666	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:10:00Z	0.0006495	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:12:00Z	0.0006525000000000002	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:14:00Z	0.0006213333333333334	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:16:00Z	0.00067	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:18:00Z	0.0006268333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:20:00Z	0.00065	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:22:00Z	0.0007218333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:24:00Z	0.0008045	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:26:00Z	0.0007021666666666666	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:28:00Z	0.0007801666666666667	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:30:00Z	0.0007841666666666668	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:32:00Z	0.0007666666666666667	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:34:00Z	0.0007733333333333333	MomentAenergy	büro_shelly1pm
0	2022-12-20T00:14:27.969100353Z	2022-12-20T12:14:27.969100353Z	2022-12-20T07:36:00Z	0.0007885	MomentAenergy	büro_shelly1pm

Are you sure about that?
Looking at the Shelly docs, aenergy is an object containing 3 properties; total, byminute & minute_ts, which one are you selecting?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.