SHELLY PRO 3EM | API | total_act/total_act_ret | combined instant phases power instead of sum of counters

  • Hi community,

    Based on the API ref  total_act  and total_act_ret supposed to be total energy imported/exported from/to grid.
    In this thread this was discussed a bit Shelly pro 3EM , MQTT raw data info

    The behaviour I was expecting is that the values would represent instant power of all 3 phases times the time, e.g. (A Power + B Power + C Power) * Time = Total energy imported in case of positive value and Total energy exported in case of negative value.

    But based on the comparison of the individual phases energy is simply sum of the corresponding fields for each phase total_act = a_total_act_energy + b_total_act_energy + c_total_act_energy and total_act_ret = a_total_act_ret_energy + b_total_act_ret_energy + c_total_act_ret_energy, which not only makes total_act and total_act_ret redundant but does not reflect the real utilities meter's measurements, which takes into account the current sum of all the phases power.

    Hope this finds the right people to look into.

    Cheers,

    Alex

  • but does not reflect the real utilities meter's measurements, which takes into account the current sum of all the phases power.

    If don't know if i understand you correctly, but "the current sum of all phases power" or "instant power" is not what "total_energy" means.

    Power is momentary power in Watts, energy is power during a certain amount of time, that's why all values you refer to (like 'c_total_act_energy' for example) are in Wh (Watts/Hour).

    I have no Pro-3EM, just a 3EM, so i can't tell if it's absolutely the same.

    Just look at the picture, you will see the difference.

    Second, no shelly i would know of sums up energy values from all 3 phases internally, even though this has been requested often here.

    You have to calculate the sums yourself since the EM, 3EM, Pro-3EM are no counters like the one from your power company, they're not intended to be.

    Greetings, Maxx

  • Hi Maxx,

    First, thanks for clearing up the Power vs Energy topic.

    Zitat

    no shelly i would know of sums up energy values from all 3 phases internally, even though this has been requested often here.

    By the looks of it Shelly Pro 3EM API does provide the values total_act and total_act_ret but unfortunately not based on the momentary power of all 3 phases combined.

    I will try to extend my explanation a bit more:

    Pa - Power Phase A
    Pb - Power Phase B
    Pc - Power Phase C
    P = Pa + Pb + Pc; - cumulative momentary power of the installation

    Eia = ∫ Pa(t) dx; (Pa(t) > 0) - Energy imported (positive value) over time period of Phase A - a_total_act_energy

    Eib = ∫ Pb(t) dx; (Pb(t) > 0) - Energy imported (positive value) over time period of Phase B - b_total_act_energy

    Eic = ∫ Pc(t) dx; (Pc(t) > 0) - Energy imported (positive value) over time period of Phase C - c_total_act_energy

    Eea = ∫ Pa(t) dx; (Pa(t) < 0) - Energy exported (negative value) over time period of Phase A - a_total_act_ret_energy

    Eeb = ∫ Pb(t) dx; (Pb(t) < 0) - Energy exported (negative value) over time period of Phase B - b_total_act_ret_energy

    Eec = ∫ Pc(t) dx; (Pc(t) < 0) - Energy exported (negative value) over time period of Phase C - c_total_act_ret_energy

    Ea = EIa - Eea; a_total_act_energy - a_total_act_ret_energy

    Eb = EIb - Eeb; b_total_act_energy - b_total_act_ret_energy

    Ec = EIc - Eec; c_total_act_energy - c_total_act_ret_energy

    E = ∫ P(t) dx - Energy imported/exported (positive/negative value) over time period of Combined Power - total_act - total_act_ret;

    Due to sum rule of Integration ∫ P(t) dx = ∫ Pa(t) dx + ∫ Pb(t) dx + ∫ Pc(t) dx = ∫ (Pa(t) + Pb(t) + Pc(t)) dx; E = Ea + Eb + Ec;

    Shelly Pro 3EM API provides all of the mentioned values.

    Hope it is clear up until this point.

    The problem I am having is that values total_act and total_act_ret although together reflect the correct total amount of energy for the installation, separately they represent sums of energies of individual phases and not the imported and exported values of energy for the momentary power of the installation.

    Ei = ∫ P(t) dx (P(t) > 0) - Energy imported (positive value) over time period of the installation;
    Ee = ∫ P(t) dx (P(t) < 0) - Energy exported (negative value) over time period of the installation;

    total_act = Eia + Eib + Eic;
    total_act_ret = Eea + Eeb + Eec;
    E = Eia + Eib + Eic - Eea - Eeb - Eec = Ei - Ee;

    BUT
    Ei <> Eia + Eib + Eic;
    Ee <> Eea + Eeb + Eec;

    What I was hoping total_act ("Total active energy on all phases, Wh") and total_act_ret ("Total active returned energy on all phases, Wh") will represent ∫ P(t) dx (P(t) > 0) and ∫ P(t) dx (P(t) < 0), but not simply Eia + Eib + Eic and Eea + Eeb + Eec

    Example:
    Pa = 100W

    Pb = 200W
    Pc = -300W
    P = 0W


    After an hour with this load:

    Eia = 100Wh
    Eea = 0Wh

    Eib = 200Wh

    Eeb = 0Wh

    Eic = 0Wh

    Eeb = 300Wh


    E = Eia + Eib + Eic - Eea - Eeb - Eec = 100Wh + 200Wh + 0Wh - 0Wh - 300Wh = 0Wh

    BUT
    Ei = Eia + Eib + Eic = 100Wh + 200Wh + 0Wh = 300Wh; current value returned in total_act
    Ee = Eea + Eeb + Eec = 0Wh + 0Wh + 300Wh = 300Wh; current value returned in total_act_ret

    Instead of Ei = 0Wh and Ee = 0Wh since P never left 0W during this hour.

    Hope this helps to understand my point.

    Alex

  • You are correct with what you say about "...they represent sums of energies of individual phases and not the imported and exported values of energy for the momentary power of the installation."

    The final point ist, If you want monentary Power, for each single Phase or all together, you need to get the value from the variable "power" for each phase, forget about "total_ret" etc. and do the summing up yourself.

    I know there were people who already opened up Tickets at Allterco requesting this or the like features, anyway, at the Moment.....

  • Hi MAXXL,

    thanks for getting back to me.

    As you suggest, calculating energy from total power would be one way to go, unfortunately the accuracy of the measurement would be dependent on the frequency of sampling the power value, and this might be limited, of course the best way of doing it would be right on the device.

    Thank you for mentioning that there is already a ticket related to this topic, really hope someone is already dealing with it, maybe some new fields would be soon exposed in the API for us to consume.

    Cheers,

    Alex

  • Dieses Thema enthält 10 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind, bitte registrieren Sie sich oder melden Sie sich an um diese lesen zu können.