I have an energy meter in the grid path that measures the usual stuf (current, voltage, power) and also integrates the power to an energy meter. By design this meter work bidirectional (net meter).
But the energy dashboard insists of having two separate meters for grid consumption and return.
I did not manage to find an easy way using template sensors to convert this meter to two meter without negative values.
I managed to split the power and then use the HA integration helper to have these two virtual meters calculated. But these integration meter differ ~ 10% from the ābuilt inā energy counter of the meter and sometimes some spikes produce false values that I then have to correct manually in the statistics. So I donāt want to use the integration helper of HA anymore and just split the energy meter values I already accurately receive.
Thank you. Iām in the same situation (one grid meter going in 2 directions) and this was driving me crazy.
Iāll will put that in place when I get back from work tomorrow. Thank you for describing it. This is much appreciated !
One question though: What happen when the sensor.e3dcfs_grid_energy goes unuvailable for some time ? Since this sensor is a cumulative sensor (KWh) it shouldnāt matter as this is already an integrator.
The computation doing a trigger.to_state.state - trigger.from_state.state, since the from_state.state is probably āunavailableā and not the state it had before going unavailable, my understanding is that we ālooseā the energy consumed while the sensor.e3dcfs_grid_energy was unavailable.
It mean that any delta that happened while the meter was unavailable will not be counted in the export nor in the import. This is a shame because after all the meter in kwh is an integrator and whatever the number of sample are lost, we always have the last value.
Tomorrow, Iāll add yet another intermediary helper that will always be updated with the meter value unless this value is unavailable, unknown or none.
This intermediary helper will then be used by the two integrations which mean that the input sensor will never be unavailable and will always have the last known value from the meter. This way, the difference between the from_state and the to_state will always give the real delta of the real meter and we wonāt loose any kWh.
Hello zorglups. Thanks it helped. It working fine since march. And since e3dcfs_grid_energy itself is an template sensor combining 3 phase counters, it will probably not be unavailable for a long time. I am not sure what would happen.
I have sometimes other wrong values to correct on other energy counters:
Of coarse I could correct that then in statistics.