I have a separate charge for my electricity, which is a flat fee thats added to my usage amount each day. Lets say this fee is 0.60 GBP per day.
I’d like to add this amount to the usage cost amount (which I have a daily figure for), but I’d like the total (usage + standing charge) to be for a rolling month.
I can get the monthly usage amount by just creating a utility helper, but how do I then add the total number of days (so far) in the month x the standing charge rate to this ?
Actually turned out to be super simple.
I created an input number helper to hold the value of the standing charge, and created a utility helper to track the usage costs with a monthly reset period, then just add the two together in a template sensor:-
- platform: template
sensors:
electricity_cost_monthly:
friendly_name: Total Electricity Cost Per Month
unit_of_measurement: "GBP"
device_class: monetary
value_template: >
{% set days_passed = now().day %}
{% set standing_charge = states('input_number.electricity_standing_charge_cost_in_gbp') | float(1) %}
{% set usagecost = states('sensor.frient_monthly_electricity_usage') | float(1) * states('input_number.electricity_tariff_cost_in_gbp') | float(1) %}
{% set total = (days_passed * standing_charge) + usagecost | float(0) %}
{{total}}
you seem to have answered your own question which is always good, but there are some other threads on here around electricity standing charge and in particular getting it onto your Energy Dashboard that might be of interest to you…if it’s something want to do have a look here Energy - How to account for daily standing charge? - #29 by bjeanes
Thats an interesting take on it. Faking a very low consumption so you don’t skew your real consumption numbers, then multiply up the standing charge so you get the right value based on the tiny consumption amount.
I’m not super fussed in getting it onto my energy dashboard, so I’ll stick with my approach for now, but thats for the link.