Energy - How to account for daily standing charge?

hm it’s kinda strange. I now checked on it again. it jumped from 0,001 to 0,002 at 2 PM local time. Though i have to admit i fiddled around with it and set the starting date to 2022-09-28. I initially deployed it however around 12 AM, at least thats when it started to tick to 0,001.

So as for now, it seems that it started ticking on its first regular basis on 2 PM. It produces a single bar in the engergy meter and i am not sure if thats now for the whole day, or only for 1 hour. If it’s meant to be for the whole day, then the costs would be incorrect.

I am a bit confused to be perfectly honest.

The increment is once per day so you need to adjust your price to reflect that.
I’ll report back tomorrow when i get to 0.002.

1 Like

oh damn. I miscalculated my total supply charge when recalculating the other way around. It’s works out perfectly for me!

So two questions remain for me:

  1. is it possible to have it calculated on an hourly basis. I think not, as i read that the factors in the energygrid would not allow that many decimal numbers. is that true? more granular distribution would be nice
  2. any idea how i can shift that supply charge at least to hour 0, or hour 1 of the day ? i know it’s mostly cosmetics but i am a sucker for stuff like that.

generally, i think this should be implemented by the hass team natively by now. i have not heard of a single energy bill which has no basic charge, supply charge, service charge or network fees.

thanks all for now !

Hi all. In theory, you could have calculate the number of hours instead of days between now and the starting date, but then you’ll have to make sure the price you give the entity also adjusts it by a factor of 24.

Personally, I don’t think this makes sense to do as it’s not what the energy retailer does (at least not the ones I’m familiar with).

I also had mine update around 2pm and I don’t know why that is. It might be something to do with when the HA energy dashboard does statistics calculations or it might be something to do with time zones perhaps. I haven’t looked into it because all I really cared about is that it increments by my supply charge once within a 24 hour window and that I have the statistics over the longer term.

1 Like

alright, thanks to you

I’m going to test a version of this where the value template is just:

{%- if now().hour < 12 -%}
   0.001
{%- else -%}
   0
{%- endif -%}

In the morning, this will register 1W and in the afternoon 0W. This should work because of state_class: total_increasing which, according to these docs carry the semantics of:

A decreasing value is interpreted as the start of a new meter cycle or the replacement of the meter.

If this works, then it will mean there is no need to customise the template for each time it is set-up by a new person.

Still no luck for me…
The energy consumption is increasing correctly (now on 2W on day 2, but this isn’t translating into a cost on the dashboard)

What price did you give the entity when you added it to the energy dashboard? Did you multiply it by 1000 as per my instructions?

If your daily supply charge were £1/kWh, then this would only be 0.2p so far. You’d have to add this entity at £1000/kWh, since we are only incrementing a single watt per day with this approach.

Thanks bo. Yes I did set that correctly I set it to 330 as my daily supply charge is £0.33

However this morning it has started working, so I think it just needs a little while to kick in. And perhaps I was fiddling around with too many settings trying to get it to work.

Great solution thanks!

Good solution. I went with your method and it is working fine for me. Thank you for sharing it

1 Like

the energy solutions seem half baked. Though i got the daily standing charge to work as posted before, my actual per kWh Cost for my real energy entity does not work for days and suddenly yesterday it calculated finally the costs for 1 single day. (i opened a thread for this)
I am a bit flabbergastered as this was implemented well over a year now. Also there is too less data for me to debug it myself, so i kinda have to wait and see where it gets us…

I will probably try to get my data into influx and use grafana for the time being.

Hello, thx for this.
I’m very new to HA, and I get most of it, but the scripting part …arghh.

Well, I really don’t understand how this line can generate 1W per day as the calculation will change every day, since the now() will be different …

Could you please explain the logic behind it ?
sorry for such a newbee question, but I’ve spent 2h hours on this ^^

On my side I would like to do just like this but only once per month on the 9th.
so I was thinking to add

trigger:
  - plateform: time
    at: :01:00:00"
sensor:
  # Increases every month by 1W to fake a monthly supply charge in energy dashboard.
  - state: >-
      {% if now().day == 9 %}
        0.001
      {% else %}
        0
      {%endif%}
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    unique_id: CHANGE_ME_TO_ANYTHING_JUST_MAKE_IT_UNIQUE
    name: "Monthly supply charge"

would this work ?

thx a lot

Okay, so as I could not get this to work, here is what I did

  • Create an input_number

  • Create an automation :

    • to set the input number to 0.001
    • at 01:00:00
    • when the day is equal to 9 (my bill start on the 9th)
  • Set a template sensor to use the input_number as m3 (as my energy dashboard started in m3 I don’t want to loose the data to switch to kWh)

  • Add the sensor to the energy dashboard with my monthly fixed charges

One question remain :
when do i need to set the input number back to 0 in order to charge only 1 time ?
I mean how long does it take for the dashboard to record this and apply the charge in € ?

Thx a lot for your help

- platform: template
    sensors:
      energy_import_cost:
        friendly_name: 'Import Cost'
        icon_template: mdi:home-import-outline
        unit_of_measurement: '$'
        value_template: "{{ (states('sensor.grid_consumed_energy_day') | float * 0.262026 + 0.9393) | round(2) }}"

did you add this as a utillity meter?
I’m not sure how to use your solution, can you provide more infomation please.

many thanks, this worked as descibed and insurctions were easy to follow.

a side note: did you get this alternate method to work:

With total_increasing , I think it could even work to just have a sensor which toggled between 0 and 1 every 12 hours as the 0 will be interpreted as a start of new cycle, but I haven’t tested that.

I still haven’t tested it tbh!

I’ve Been follow this thread and use method here for while, I updating various things and came across counter helper. not sure when it got added to HA but it is useful in this case. Add a counter eg counter.daily_counter

Create an automation to increase counter daily something like this

alias: Energy quaterly counter
  trigger:
    - platform: time
      at: '00:00'
  action:
    - service: counter.increment
      data:
        entity_id: counter.daily_counter

Also create an automation to reset counter every bill cycle

so everday the counter go up by one

Then create a sensor for (counter) x (daily supply charge)

      supply_cost:
        value_template: "{{ (states('counter.daily_counter) | float * states('sensor.price_daily_supply') | float) | round(2) }}"
               

here all services for counter

Thanks for this. Only change I made was make it explicitly 1 (instead of 0.001) and change units to 1 Wh… I was more so curious would HA handle Wh usage with a kWh price… Which worked fine.

I stuck with a kWh price as my standing Charge is 0.9976 euro per day… Which gets rounded on the energy dashboard anyway…

2 Likes

See: Energy: Add fixed daily cost - #56 by jbhobson

I stumbled across this solution GitHub - Rumbaar/Electricity-Daily-Charge-HA: Calculation of a static daily rate charge over 24 hours, inline with the hourly metric of the energy dashboard in Home Assistant.

I like the way a) the standing charge can be pulled from the supplier and therefore no need to manually set a fixed price in the energy monitor settings b) the standing charge accumulates on the energy graph during the day to the full price by the end of the day.