TotalKWH on Shelly 3EM Pro?

Hi all

Installed a Shelly Pro 3EM and integrated it. I’m a bit surprised but it looks like there is no channel totalKWH, only a returnedKWH.
What is returnedKWH exactly?
How can I record the totalKWH consumed?

In the end, I would like to record the number of KWH consumed today, this month, this year.

Thanks a lot

When activating MQTT, I get more detailed information from the Shelly, but it’s a bit cryptic to me. Usually, the events/rpc topic returns the usual values for all 3 phases like power, voltage etc.:

  "params": {
    "ts": 1715444140.64,
    "em:0": {
      "id": 0,
      "a_act_power": 242.5,
      "a_aprt_power": 320.3,
      ...

But once in a while, a different message appears:

"params": {
    "ts": 1715443980.67,
    "events": [
      {
        "component": "emdata:0",
        "id": 0,
        "event": "data",
        "ts": 1715443920,
        "data": {
          "ts": 1715443920,
          "period": 60,
          "values": [
            [
              3.7814,
              3.7826,
              0,
              0,
              0,
              2.5151
              ...

A long list of values follows. The first one (3.7814) i.e. is the “Energy last minute” I can see on the web interface of the Shelly:
image

So I could listen to these messages once a minute, extract the correct values from the array and use that to accumulate the total energy used. And hope, the array structure never changes…

Think there has to be a better solution I haven’t found yet :thinking: