Strange effect of Template sensor and utility meter

I have a template sensor which converts my KNX-energy meter in W to kW:

KNX sensor (W) => Template sensor (kW)

All works well, however, on startup before the first read on the KNX-bus, the template sensor briefly goes to 0; probably because there is no KNX-value yet.

Now I use this template sensor as input for a utility meter which resets daily.

KNX sensor (W) => Template sensor (kW) => Utility meter (kW/daily)

Because of the brief reset to 0, every reboot of Home Assistant causes an enormous jump in the utility meter; the absolute value of the template sensor gets added to it…

And now the weird thing: If I change the order, it works just fine:

KNX sensor (W) => Utility meter (W/daily) => Template sensor (kW/daily)

No clue why this is the case…

Thomas

The utility meter needs an energy sensor (unit Wh or kWh) not a power sensor (W or kW).

If you don’t have an energy sensor from knx you can use the integration sensor to convert your power measurements into consumed energy, then feed that to the utility meter.

It is important to select the correct method of integration. See:

Yes, sorry, messed that up in my post. The measurement and units are Wh / kWh, so that is not the problem.

Thomas

Are you adding sensor.xyz in the utility_meter source?