We have just implemented German Messkonzept 8, meaning
Grid ↔ Meter M1 ↔ Heatpump ↔ Meter M2 ↔ Household and PV
E_hh,in = M2(in) is household energy
E_pv,out = M1(out) is PV energy sold into the grid
E_hp,in = M1(in)-M2(in) is heatpump energy (cheaper)
I am continuously reading the meters via the optical interfaces. E_hh,in and E_pv,out are direct measurements and no issue, they are just MQTT sensors as total_increasing.
E_hp,in, however, IS an issue. I made a template sensor with the difference, but unfortunately, M1 has kWh resolution, while M2 has Wh resolution. So when household energy is taken from the grid, M2 continuously increases, while M1 takes steps of 1kwh, which leads to a sawtooth curve in E_hp,in. This is obviously bad for total_increasing.
Is there a canonical way to deal with this, or do I have to either hope for my grid operator to tell me the PIN for the meter to change the reporting accuracy, or implement something in the reading microcontroller?