So there is workaround using Gas part of the Energy Dashboard, but if you have gas as well, there is no good way how to do it.
If you have fixed electricity price, its pretty easy to with an template sensor, but if you have changing electricity price like Nordpool for example, it gets pretty complex.
From energy (kwh) sensor - this is a preferred way as it’s more precise. Calculations are made every time energy sensor changes. Difference between last reading and current reading are multiplied by current electricity price and added to the daily, monthly, yearly cost sensors which will reset accordingly.
From power (kw) sensor - if your device don’t have energy sensor, you can use this. It has same integration left method logic to calculate cost. daily, monthly, yearly cost sensors which will reset accordingly.
Roadmap:
Hacs. At the moment only manual install
Integration configuration ui to have filtered list where you can search entities. At the moment manual entry only.
Great work on this one! Works like a charm.
Is it possible to manually reset all values? A good thing to do when experimenting. I tried to remove the device and add it, but it’s too smart and reminds the value.
Thanks for the update.
I’ve created a simple script and Button on the homepage to trigger the reset.
Because I won’t make an “Oopsie”, I’ve created the script with an confirmation message.
Script
alias: Charger_Action_Reset_Montly_Costs
use_blueprint:
path: homeassistant/confirmable_notification.yaml
input:
notify_device: <DEVICEID>
title: Reset Sensor Montly PowerCharger
confirm_action:
- service: dynamic_energy_cost.reset_cost
target:
entity_id: sensor.car_charger_usage_monthly_energy_cost
data: {}
message: >-
When confirming this action, the montly Charger status will be reset
to 0.
icon: mdi:rewind
When you click on the button on the homepage, it will send a message to your device (in my case, my mobile phone) and I can confirm with clicking on “Confirm”. Only then, the sensor will be reset.
Note: This is an easy and first script for this sensor. Built for testing.
I wish you published this a few days earlier. I spent a few hours last week creating a multitude of Utility Meter entities, tariff helpers, etc. just to track a couple of devices.
I haven’t tried your code yet, but it sounds like it should make my job a lot easier next time! Thank you.
I feel you and the reason I made this was exactly this. I still hope, this will be a part of official HA energy dashboard in the future, but until then I hope I save people time a bit.
@arva It’s not a bug, but a request. Is it possible that you change the versions in the manifest.json file? On this moment I didn’t knew if I’ve 0.4.0 or 0.4.1 already. When the manifest.json file is updated, you can see the version in the gui or in the manifest.json file.
I just translated EUR in all documents in \config\custom_components\dynamic_energy_cost to NOK for this purpose. I used notepad++, opened all the files, and used the replace in all open documents for this. This is propably not a good way to do this, but it seemed to work for me
Also I changed the divisor value in the file “power_based_sensors.py” on line 85 from “/ 1000” to “/ 1000000” as Nordpool provides prices in øre and not kroner/NOK.
It probably is not the smartest workaround, as some/all of it would be overwritten by the next update.
The change from EUR to NOK/SEK etc. could maybe be implemented in the translations in “\config\custom_components\dynamic_energy_cost\translations” ?
Excellent work Arva! This is terrific!
Thank you very much!!
A few neat additions if possible:
User selectable Currency
Reset schedule… for example, regularly resetting the monthly sensors at the end of the billing period i.e the 27th day of each month (I am aware this can be done with automation - its just a “nice to have” feature request)