Energy - How to account for daily standing charge?

Thanks a lot for this genius hack! Rather than distributing the supply charge throughout the day, I tried to keep it simple and create a spike when the time transitions to the next day. Also I can use the supply charge cost from my energy retailer as is.

template:
  - sensor:
      - name: "Supply Charge"
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing
        state: >
          {{ (as_timestamp(states('sensor.date_time_iso')) / 86400) | int }}

Will this come and bite me in later on somehow?

Hi @aksvenk, this approach is fine, except you must remember by doing it this way you are adding 1kW to your power consumption every day, which may be significant in your overall consumption. My average daily usage is about 15kW so this would introduce a margin of error of about 6-7% every day.
That’s why I divided it by 1000, so I’m only adding 1w per hour which is negligible and an error margin of about 0.1%. I chose 1w because it seems to be the lowest unit of power HA will allow.
In your case if you mutliply the charge by 1000 and divide the sensor by 1000, it would only be 1w per day which would be even better.

Good point @muzzak. The supply charge shows up as a separate line item so I’m not too fussed.
But I see what you mean especially when we are tracking monthly / yearly totals.

As per your suggestion, I’ll change the above unit to Wh and then multiply the supply charge by 1000.

Hi Michael,
Yes that’s correct, as per the yaml standards one heading with utilities as subentries beneath indented or a reference (as I have done) to a separate file for your multiple utility entries.
Thanks,
Sean

Thank you @muzzak for this. I was stumped at first with an error but that was soon resolved with the addition of:

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'

Cheers
Simon

Yes @simonranson, good point. I should have mentioned you need the Time and Date integration as well Time & Date - Home Assistant

Hi @muzzak @aksvenk I’m trying to get this code working but the daily cost is zero.

Please are you able to share to final code for the once off daily “spike” - i prefer this option than the cost calculation over the entire day.

Also what “static price” do you use in the Supply Charge for the Grid Consumption dashboard using this approach?