I know topic tells nothing but I don’t know how to describe it in single sentence. If you have any idea after reading this - tell me and I will change the topic (if possible).
So, I have a heat pump to heat my house. Fortunatelly it has pretty cool integration for HA. What you see here:
is a graph of heat pump modulation. In other words it just shows when heat pump was working and at what percentage power level (100% means 8 kWh, 50% is 4 kWh and so on).
I want to make few sensors which based on this sensor shows total consumed power per day / week / month. For simplicity of this example - let’s say that pump was working on 100% on 3 hours and on 50% for another 3 hours. This gives us 8x3 + 4x3 = 24 + 12 = 36 kWh per day. If this is a problem to covert it from time unit to kWh it will be good as well to keep it in time unit (minutes) this way:
Following previous example 100% * 3h + 50% * 3h = 3h + 1,5h = 4,5h.
Since 4,5h * 8kWh = 36 kWh it’s still clear to understand. So whatever option from those two possible but you get my point. At the end there can be additional sensor which just multiplies this first sensor value by 8.
Assuming your integration does not have a power senor, first create a template sensor that converts modulation to power (which is kW not kWh as in your explanation).
Feed this sensor to the Riemann Sum integration to get an energy consumed sensor (again, assuming your integration does not have one already):
sensor:
- platform: integration
name: Heatpump Energy
source: sensor.heatpump_power
method: left
Feed this energy sensor to Utility meter helpers to track daily, weekly and monthly energy. These can be set up in Settings → Devices & Services → Helpers.
You can also add the heatpump energy sensor to the Energy Dashboard as an individual device.
First of all I really appreciate for your reply. Second - sorry for late response but didn’t had time to play with this.
So I made 2/3 points of your instructions so far. Then forced heat pump to work just to collect some data. Honestly it gives me some sick values. After around 5 minutes of heat pump working I get readings like this:
Names of entities are exactly as in your config examples above.
I assume that reading are not incorrect but simply put “comma” , in incorrect place. But this is only my assumption. Maybe it’s due to converting percentage to power. Maybe 100% percent is not treated as 100/100 but as like 100. I don’t really know.
That would actually makes sense that simply “comma” is not in right place.
Over those 5 minutes it could consume around 0.23867 kWh with current power consumption at level 4.16kW.
I need to ask you one more thing. Since at the first hour of sensor working it was multiplicated by 8 instead 0.08 sensor gathered some huge numbers. I wanted to reset this so I did the easiest thing possible - meaning delete database However tho every entity history reset EXCEPT this sensor:
How is this even possible??? After deleting DB it shows 0 but once pump starts (modulation > 0) it momentary shows this huge number. Where does he stores that value if I deleted database? It doesn’t make any sense to me. I got rid my whole HA history to get rid of it and this is the only thing I didn’t get rid of.
Even tho I’m dumb or it’s not working right. I’ve found yesterday 185kWh entry and changed it to 0. However then today I see somewhere in time -185kWh entry. When I change this one to 0 as well the previous one goes back to 185kWh.
Anyway why deleting database didn’t cleared that? Where HA is keeping those values then?
As you can see graph starts at 23.09 at 19:40. I’ve edited it via developer tools and changed entry from 19:40 from 185 (same as graph begins) to 0. Even tho history graph still starts at 185.
No - I didn’t stop HA first. I simply deleted home-assistant_v2.db and then immediatelly restarted HA. I also did that when heat pump was not working meaning that modulation was 0 to make sure it won’t try to update database meantime. It worked for all other entities
If I have HassOS, Supervisor and all that stuff how do I simply stop HA Core itself without shutting down HassOS just to delete database and then restart?
This is absolutelly ridicoulus. I just did what you said - stop core, delete DB, start core. Just after start it’s still showing the same values as just before removing DB.
Where is he getting this data from??? For air?
Maybe they are stored in some log files? They must be stored somewhere.
I just did it along with deleting DB again. As you said I edited file and changed values to 0. After restart everything seems to be finally fine (all values are 0). But now I’m waiting for another heat pump start. After that I can be absolutelly sure it’s fine.
I will let you know once pump starts and will run for a while.
Next items says today, this week, this month and overall.
On Monday I will call heat pump guy. If he tells me that 100% modulation is not 8kWh then I will be pissed off
Anyway thanks again for your help! I think topic can finally closed now.
One more question - my HA recorder is set to keep history for 30 days.
However I assume that entity sensor.heatpump_energy will keep tracking overall consumption forever just history will be from last 30 days? Is that correct? I mean that after 3 months I will have total number from 3 months but history graphs from last month only?