How often the integration refresh and recalculate?
Great work!
I have used version 0.1.0 with my EV charger and just updated to 0.5.0 via custom repo in HACS.
That created new entities with (in my case) 0 SEK, an manual update replaces also all files as I’m aware of. Is there a way that consumed energy can survive an update, or did I missed something?
If not, do you think there is possibility to write data to a separate file that is created by integration, in that way file will not be overwritten by update and consumed amounts will preserve.
Yeah, about that. Could you please add the possibility to define currency anyways. I get my hourly prices from Nordpool in cents/kWh, while my default currency is EUR, so…
Yes, it works perfectly. This is from my water heater, using 3 kW until 4 PM today. Great work, @arva!
As I am not a programmer this took some testing to put together correctly. I hope it may be useful for others. The variable price of power in Norway (per kWh) is made up of two parts, the energy itself and for use of the grid. The energy price change every hour, the grid use has a low and a high price, depending of time of day and if it is a workday or not. The energy price is simple - i get that from an integration (Tibber or Nordpool). The grid part I have to add myself, and this Template sensor does the job for me, with two helpers “input number” to make it possible to change the price when updated without editing yaml code. Finally I use a helper that sums the two parts, and that is what i use in Dynamic Energy Cost.
This is in my sensor.yaml file (can also be in configuration.yaml):
- platform: template
sensors:
bkk_nettleie:
friendly_name: BKK Nettleie
unit_of_measurement: NOK/kWh
value_template: >
{% set tariff = { "dag": states('input_number.bkk_nettleie_dag'), "natt": states('input_number.bkk_nettleie_natt_helg') } %}
{% if is_state('sensor.calender.norway', 'On') %}
{{ tariff.natt }}
{% elif now().weekday() >= 5 %}
{{ tariff.natt }}
{% elif now().hour >=6 and now().hour < 22 %}
{{ tariff.dag }}
{% else %}
{{ tariff.natt }}
{% endif %}
Hi, I set the integration up yesterday to run overnight and I’ve got a result that doesn’t like up with what I had expected. It must be a configuration issue on my part as the produced cost graph follows the same curve as the kWh consumed graph:
The cost output for last night’s usage is many times higher than what it should be. The kWh usage was 5.27kWh at a rate of £0.1195/kWh (£0.6297).
Any ideas where the £3.55 figure has come from? It would suggest a unit rate of £0.6736/kWh (with 5.27kWh) or 29.7kWh consumed at £0.1195/kWh.
I thought it may have used the day rate initially but that doesn’t math right either.
I have used the sensors in the images above in the configuration for the integration.
Update
Clearly I made some configuration error initially. I went through and deleted the original entities and reconfigured the integration using a kWh sensor. The new entities populated with the existing bad data but last night the daily sensor reset and now shows a much more sensible number of £0.32 kWh usage. I will manually reset the weekly, monthly and yearly entities and start fresh.
Thanks for making a great integration arva.
This is great, thank you for creating this!
Hi,
What card this is? Or custom CSS? Do you mind to share code?
Sure !
type: entities
title: Electroménager
entities:
- entity: sensor.lave_linge_electric_consumption_kwh
type: custom:multiple-entity-row
name: Lave-linge
secondary_info: last-changed
icon: mdi:washing-machine
entities:
- entity: sensor.lave_linge_electric_consumption_kwh_daily_energy_cost
name: Jour
format: precision2
unit: €
- entity: sensor.lave_linge_electric_consumption_kwh_weekly_energy_cost
name: Semaine
format: precision2
unit: €
- entity: sensor.lave_linge_electric_consumption_kwh_monthly_energy_cost
name: Mois
format: precision2
unit: €
- entity: sensor.lave_linge_electric_consumption_kwh_yearly_energy_cost
name: Année
format: precision2
unit: €
- entity: sensor.lave_vaiselle_electric_consumption_kwh
type: custom:multiple-entity-row
name: Lave Vaiselle
secondary_info: last-changed
icon: mdi:washing-machine
entities:
- entity: sensor.lave_vaiselle_electric_consumption_kwh_daily_energy_cost
name: Jour
format: precision2
unit: €
- entity: sensor.lave_vaiselle_electric_consumption_kwh_weekly_energy_cost
name: Semaine
format: precision2
unit: €
- entity: sensor.lave_vaiselle_electric_consumption_kwh_monthly_energy_cost
name: Mois
format: precision2
unit: €
- entity: sensor.lave_vaiselle_electric_consumption_kwh_yearly_energy_cost
name: Année
format: precision2
unit: €
- entity: sensor.seche_linge_electric_consumption_kwh
type: custom:multiple-entity-row
name: Sèche Linge
secondary_info: last-changed
icon: mdi:washing-machine
entities:
- entity: sensor.seche_linge_electric_consumption_kwh_daily_energy_cost
name: Jour
format: precision2
unit: €
- entity: sensor.seche_linge_electric_consumption_kwh_weekly_energy_cost
name: Semaine
format: precision2
unit: €
- entity: sensor.seche_linge_electric_consumption_kwh_monthly_energy_cost
name: Mois
format: precision2
unit: €
- entity: sensor.seche_linge_electric_consumption_kwh_yearly_energy_cost
name: Année
format: precision2
unit: €
Thank you for sharing your project. This is what I was looking for and tried to configure multiple times. I am not sure if this issue is caused by the sensors or a mistake in the code. After each reboot:
I use a sensor that tracks the lifetime counter in kWh. When setting up the integration, it starts counting from that point onward. However, if there is a reboot of Home Assistant, it calculates based on the real counter instead of the delta from when the integration was set up.
normal way of calculating:
after reboot:
any idea on how to solve this?
I installed this addon recently and added my devices and linked them to my P1 meter, which are filled in with day and night rates via the Energy tab.
Most of the devices do not have much correct prices because then the electricity would be very expensive.
I am slowly switching from Homey to Home assistant and in Homey there is an app called “Power by the hour” that I use.
When I compare the data from Dynamic Energy with Power by the hour in Homey I see big differences and I know that the app works well when I compare it again with what I see in my Homewizard P! meter software.
My P1 meter automatically changes to rate 1 and 2 at 23:00 and 07:00.
I have also tried it with a utility meter that set the two rates via an automation at the correct time, but in both cases the result is the same and incorrect.
Attached are some pictures to make things clearer.
What am I doing wrong?
This is how I have it set up and have tried both options. Which one is correct?
This is the rest of my data.
Thanks.
Is there a way to change the price sensor in an existing configuration? My Nordpool sensor changed the naming for the zones, thus the name of the sensor changed as well. I could setup a new sensor, but then I do not have the old data anymore.
I think this is kind of a weakness of Home Assistant, but I don’t think that will change anytime soon.
This will not help you now - but a way to avoid the same problem later. Take a look at what I wrote in this thread aug 24. I have created a helper that sums grid tariff and energy price and use this helper as the price sensor in Dynamic Energy Cost. If there are changes to either grid tariff or energy price sensor I can update the helper without loosing the history.
i reccomend to just change the entity id back to what it was. So all your other stuff that used Nordpoo works as well. This Nordpool naming is pretty bad to be honest.
I follow this threat.
Last august I’ve also created a feature request:
In my specific case, my Vehicle charger was defect and it was switched. My entity has been changed in HA and the Entity ID in the app couldn’t be changed. I’ve configured it again, but my history has been lost now.
I hope there should be a nice feature available to have a way to change the value without loosing history.
How to keep history when replacing a device has been discussed before and there are suggested sullitions for this. I have not tried them myself, but i would create a new backup before testing this. Take a look at this thread: Replace entities and keep history (BREAKING CHANGE starting HA Core 2023.4) - #4 by e-raser
The entity changed the name because the source and the integration that uses this source gave it a new name. It is not possible for me to change the entity id back.
Hi All!
I’m sorry I haven’t maintained the integration for a while. Unfortunately can’t promise to have time in the near future as well.
Few recommendations so you aren’t so dependable of the integration logic:
- If you have enegy (kwh) sensor, use this. Only if you don’t have, use power (W) sensor. Reason is that the energy calculations are more precice
- Make a sensor with my integration and make unlimited amount of HAUtility Meter sensors for different periods you would like (all time, hourly, daily, two days, whatever you like).
I have seen all the ideas and request here and github, but just don’t have what it takes to implement these.
i’m really thrilled that so many people found something, I thought was only my need , so useful. Now I feel a bit bad letting you all down not maintaining what I started. If anybody is interested in contributing and doing what needs to be done, I would gladly give all permissions in github to continue what i started. I mean, this is what opensource sould be in my view.
In my opinion this functionality is something that would be nice to see in Home Assistant core. It would make so much sense to have a cost/profit side in the energy management.
Maybe you found a solution already, but for showing previous data I use the history-explorer-card integration:
https://github.com/SpangleLabs/history-explorer-card