How to Calculate Historical Power Consumption For a Given Period

Juddy14
Posts: 8
Joined: Thu Mar 20, 2025 9:06 am

Post

Hi,

I am kind of confused by the values shown on the graph in Cloud vs CSV/API output.
In this case, I've selected 26.03.2025 19:00-26.03.2025 20:00.
Cloud - total power consumption 0.28574 kWh
CSV/API - total power consumption 155408-139120=16288/100000=0.16288 kWh

No matter what I try, I can't get to the same result as in the Cloud.

How do I calculate the total power consumption from the values in CSV/API?
What if the API returns only just one row, how do I get the total power consumption then?


JSON data from REST API

Code: Select all

[
    {
        "date_timestamp": 1743012107,
        "phase1_fae": 10246,
        "phase1_rae": null,
        "phase1_fre": null,
        "phase1_rre": 4020,
        "phase2_fae": 122636,
        "phase2_rae": null,
        "phase2_fre": null,
        "phase2_rre": 11418,
        "phase3_fae": 6238,
        "phase3_rae": null,
        "phase3_fre": null,
        "phase3_rre": 18144,
        "fae_balanced": 139120,
        "rae_balanced": null
    },
    {
        "date_timestamp": 1743012708,
        "phase1_fae": 10982,
        "phase1_rae": null,
        "phase1_fre": null,
        "phase1_rre": 4714,
        "phase2_fae": 123912,
        "phase2_rae": null,
        "phase2_fre": null,
        "phase2_rre": 12750,
        "phase3_fae": 7342,
        "phase3_rae": null,
        "phase3_fre": null,
        "phase3_rre": 20760,
        "fae_balanced": 142236,
        "rae_balanced": null
    },
    {
        "date_timestamp": 1743013729,
        "phase1_fae": 11836,
        "phase1_rae": null,
        "phase1_fre": null,
        "phase1_rre": 5808,
        "phase2_fae": 125948,
        "phase2_rae": null,
        "phase2_fre": null,
        "phase2_rre": 14956,
        "phase3_fae": 9120,
        "phase3_rae": null,
        "phase3_fre": null,
        "phase3_rre": 25118,
        "fae_balanced": 146904,
        "rae_balanced": null
    },
    {
        "date_timestamp": 1743014329,
        "phase1_fae": 12284,
        "phase1_rae": null,
        "phase1_fre": null,
        "phase1_rre": 6426,
        "phase2_fae": 127132,
        "phase2_rae": null,
        "phase2_fre": null,
        "phase2_rre": 16276,
        "phase3_fae": 10178,
        "phase3_rae": null,
        "phase3_fre": null,
        "phase3_rre": 27696,
        "fae_balanced": 149594,
        "rae_balanced": null
    },
    {
        "date_timestamp": 1743014929,
        "phase1_fae": 12432,
        "phase1_rae": null,
        "phase1_fre": null,
        "phase1_rre": 6946,
        "phase2_fae": 128520,
        "phase2_rae": null,
        "phase2_fre": null,
        "phase2_rre": 17836,
        "phase3_fae": 11566,
        "phase3_rae": null,
        "phase3_fre": null,
        "phase3_rre": 30392,
        "fae_balanced": 152518,
        "rae_balanced": null
    },
    {
        "date_timestamp": 1743015530,
        "phase1_fae": 12486,
        "phase1_rae": null,
        "phase1_fre": null,
        "phase1_rre": 7436,
        "phase2_fae": 129764,
        "phase2_rae": null,
        "phase2_fre": null,
        "phase2_rre": 19326,
        "phase3_fae": 13158,
        "phase3_rae": null,
        "phase3_fre": null,
        "phase3_rre": 33178,
        "fae_balanced": 155408,
        "rae_balanced": null
    }
]
CSV data from the Cloud

Code: Select all

Timestamp;Date and time;Phase 1 Forward active Energy kWh;Phase 1 Reverse active Energy kWh;Phase 1 Forward reactive Energy kvarh;Phase 1 Reverse reactive Energy kvarh;Phase 2 Forward active Energy kWh;Phase 2 Reverse active Energy kWh;Phase 2 Forward reactive Energy kvarh;Phase 2 Reverse reactive Energy kvarh;Phase 3 Forward active Energy kWh;Phase 3 Reverse active Energy kWh;Phase 3 Forward reactive Energy kvarh;Phase 3 Reverse reactive Energy kvarh;Forward active Energy kWh - total;Reverse active Energy kWh - total;Active Energy kWh - Arithmetic balance;Forward active Energy kWh - Vector balance;Reverse active Energy kWh - Vector balance
1743012107;2025-03-26 19:01:47;0.10246;;;0.0402;1.22636;;;0.11418;0.06238;;;0.18144;1.3912;0;1.3912;1.3912;
1743012708;2025-03-26 19:11:48;0.10982;;;0.04714;1.23912;;;0.1275;0.07342;;;0.2076;1.42236;0;1.42236;1.42236;
1743013729;2025-03-26 19:28:49;0.11836;;;0.05808;1.25948;;;0.14956;0.0912;;;0.25118;1.46904;0;1.46904;1.46904;
1743014329;2025-03-26 19:38:49;0.12284;;;0.06426;1.27132;;;0.16276;0.10178;;;0.27696;1.49594;0;1.49594;1.49594;
1743014929;2025-03-26 19:48:49;0.12432;;;0.06946;1.2852;;;0.17836;0.11566;;;0.30392;1.52518;0;1.52518;1.52518;
1743015530;2025-03-26 19:58:50;0.12486;;;0.07436;1.29764;;;0.19326;0.13158;;;0.33178;1.55408;0;1.55408;1.55408;
You do not have the required permissions to view the files attached to this post.
User avatar
pzygmunt
Posts: 19634
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

What does the smartphone app show for the same range?
Juddy14
Posts: 8
Joined: Thu Mar 20, 2025 9:06 am

Post

This is what the APP shows
You do not have the required permissions to view the files attached to this post.
User avatar
pzygmunt
Posts: 19634
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Change the data type to one bar and tap it.
Juddy14
Posts: 8
Joined: Thu Mar 20, 2025 9:06 am

Post

This is what's shown when I tap on the first bar
You do not have the required permissions to view the files attached to this post.
Juddy14
Posts: 8
Joined: Thu Mar 20, 2025 9:06 am

Post

Initially, I thought I would just sum all the rows from the following columns:

Phase 1 Forward active Energy kWh
0.10246
0.10982
0.11836
0.12284
0.12432
0.12486

Phase 2 Forward active Energy kWh
1.22636
1.23912
1.25948
1.27132
1.2852
1.29764

Phase 3 Forward active Energy kWh
0.06238
0.07342
0.0912
0.10178
0.11566
0.13158

and that would be the total consumption, but this is not the case because the numbers are incrementally larger.
But even if subtract the first row from the last row of each column, and then sum it up, you still don't get the same result.
0.12486-0.10246=0.0224
1.29764-1.22636=0.07128
0.13158-0.06238=0.0692
-------
0.16288
User avatar
pzygmunt
Posts: 19634
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Cloud and applications operate on the same data, which you can download in XLS. It may be a time shift issue. UTC vs. your time zone. PM me the channel id and email address of the account and I'll take a look at the database.
Juddy14
Posts: 8
Joined: Thu Mar 20, 2025 9:06 am

Post

I've just sent you a PM.
The issue is unlikely to be in the time zone because the data on the graph seems to match the rows in CSV, which can be downloaded via the cloud. The exactly same data I also obtained through your REST API.
You do not have the required permissions to view the files attached to this post.
User avatar
klew
Posts: 11325
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław

Post

Juddy14 wrote: Fri Mar 28, 2025 5:47 am I've just sent you a PM.
The issue is unlikely to be in the time zone because the data on the graph seems to match the rows in CSV, which can be downloaded via the cloud. The exactly same data I also obtained through your REST API.
Cloud and Supla apps on mobile, show energy as an increment from the previous measurement.
Data, you fetched, is 10 min too late, that's why you don't see first bar of data in csv/api.

First bar contain delta value of between state at 19:01 and state at 18:51. If you'll get it in csv or via api, it should give you values as shown on charts.
Supla: bo GPIO to dopiero początek.
Juddy14
Posts: 8
Joined: Thu Mar 20, 2025 9:06 am

Post

You are right, I seem to get the right values if I choose 18:50 instead of 19:00.

So let's say I want to get data from 26.03.2025 19:00 to 26.03.2025 20:00.
Does it mean that I need to query 26.03.2025 18:50 to 26.03.2025 20:00 i.e. always subtract 10 minutes from the start date?
Is that correct?

Thanks for your help.

Return to “Help”