The capacity tariff is charged on the basis of the ‘average monthly peak’ (kW). This average monthly peak is calculated as the average of your last 12 ‘monthly peaks’. The monthly peak is the highest quarter-hour power (or ‘peak power’) that you have used in a month.
So what you actually need for this is:
- a statistics sensor, to get the peak (max) reading every 1/4 hour
- a template sensor to record the highest 1/4 hour peak for each month.
- a second template sensor to record the average of the 12 monthly peaks.
That is an understatement!
You could probably use a statistics sensor for the whole month to find each monthly peak, this would essentially be the same, but it would require quite a large number of samples.