Hi,
I’d like to get the total cost of electricity (today) in a sensor card.
The energy dashboard is setup correctly - I’ve got both a standing charge and a pence per KwH cost.
The cost per KwH I’m running of a Shelley EM - I’ve set a static price (of 0.2292). That’s working fine.
For the standing charge - I’ve got an entity with the total costs and an automation setup which resets at midnight.
I’ve then setup a template sensor to pull the daily cost (combining both of the above), but I’ve not configured it right as the cost doesn’t match the total cost in the energy dashboard:
{% set kwh = states('sensor.shellyem_channel_1_energy') | float(0) / 1000 %}
{% set price_per_kwh = 0.2292 %}
{% set standing_charge = states('input_text.tariff_import_standing_charge_daily') | float(0) %}
{{ (kwh * price_per_kwh + standing_charge) | round(2) }}
Any thoughts?