Beiträge von buekliev

    Meanwhlle I've also developed a Home Assistant configuration that can do the two-way energy calculation of energy imported/exported in the household,
    making use of, e.g., a Shelly (Pro) 3EM for the load metering and a Shelly Plus 1PM for measuring the PV power in per-second resolution.

    I can see DrDvO you've reached the same integration solutions as well :)

    Hi DrDvO,


    Thanks for the links to your work, I am sure I could use some of this in my HA setup.

    In other words, you would like to get the energy totals as measured by a bi-directional energy meter (like those required for German households that produce PV energy).
    I wonder what your use case is - check if your 3EM measures correctly w.r.t. the official metering?

    Exactly, the el. meter here is the same as in DE, so it counts the energy based on combined instantaneous power form all 3 phases. `total_act_ret` and `total_act` still returns just the sum of `X_total_act_[ret]`, even after recent firmware update, which is useless, since any client can sum those up.


    Anyway, the problem I am trying to solve is that I get billed for the energy consumed from the grid only for the diff between the import and the export based on meters measurements, which are different from the 3EM readings.

    There is no API from the energy provider so the only options to track my balance is either take numbers from the meter from time to time or deal with this 3EM inconsistency situation with the values.

    I did finally end up using HA's Integration Integration (I know :)) and integrate sum of powers of all 3 phases to get the energy, which is not that precise, since there is a lot of outliers in the power readings and even filtering those won't solve the problem.

    I couldn't find any place where to file my feature request to Shelly team to make the change happen, but hopefully they realize the need for this at some point.

    Cheers,

    Alex

    Hi Maxxl,

    Absolutely agree with you.

    I don't really need super exact measurements, but +-5kWh error per month would be great. What I am trying to achieve is to determine whether my home system is net positive or negative in relation to the grid at any time. This can help me to automate power consumers at home and to calculate the energy cost.

    Will keep an eye on any news regarding thing.

    Cheers,

    Alex

    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

    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

    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