I use the Tesla custom component so I can see the added energy to my Tesla when it’s charging.
I also have a current energy price sensor (Frank Energie), this price changes every hour due to the dynamics costs.How can I create a sensor to calculate the costs per hour?
If I use a template to calculate the added energy (kwh) in my Tesla with the energy cost sensor it’s increases every hour, because every hour more energy has been added.
I think the solution is very simple but I am stuck here.
Thank for your reply, but then I have only the hourly consumption. How can I make a template/automation that every hour the consumption is multiplied by the price in that hour (because of the dynamic prices)?
You would need to create this sensor “manually”: via an automation that runs hourly, multiplying the kwh-value with the cost-value.
See here for inspiration: Manual input sensor
You can achieve the same result, with a different approach: I use the built-in energy dashboard for this.
Create a sensor withe the current kWh-price (google for the ENTSO-e integration to achieve this).
Then in HA-settings → dashboards → energy you can add or edit your electricity-usage and select “use an entity with the current price”.
The result is a calculation of your electricity costs in the energy dashboard, which you can toggle between day, month, year.
Yes. First i created a template sensor that calculates the realtime cost based on the usage in the current hour and the price of the current hour. Then i made a python app for the appdeamon that is triggerd each hour at HH:59:57. The script creates/updates a new sensor, and appends each hourly cost(of HH:59:57) as an attribute. And the state of the created sensor sums these individual hourly costs.
Here is a link to an approach I have used to quantify the savings from both my battery and solar, my prices change every 5 minutes so I needed a very dynamic solution.