Time precission related costs with several tariffs


I have a cheap-expensive tariff configured so I take into account Energy and related costs associated with both tariffs. I also have a scheduling to switch electrical heating strictly during cheap period.

The problem is that I see that expensive tariff has about 1% of the cheap value tariff, while it should be virtually 0, as I switch off all the appliances exactly at the time of cheap to expensive tariff change.

I suppose it’s related to time precission of the Riemann sum used to obtain the energy, and I don’t know if it could be set the extremes of integration sum exactly at the changing tariff times or any other way to get more exact results.

Which method are you using for the Riemann sum?

Trapezoidal is the default but for nearly all practical energy situations the left method has less error.

I’ve doubled checked and I was wrong (sorry). I have two cases:

  • In the cases I obtain the energy sensor with Riemann sum in HA, I use left method and as you say the error is almost null (0.035%).
  • In the cases where the energy is get directly from Shelly EM energy sensor, the value within expensive tariff is about 1% of expensive tariff (in a whole month may be 12 kWh).

In this case, do you know if the problem is with the integration in the Shelly EM or with the utility meter which discriminates different tariffs? (I suppose the first) If the problem is with the Shelly sensor, maybe it’s better to obtain the energy sensor in HA with left method, as you suggest before applying different tariffs.