Issue with daily hot water meter - it jumps at 1AM - throws off results

The sensor it is using is sensor.daily_hot_water.

That all reads fine i.e -

But the energy for it always has this large jump at 1AM - but the thing only is a 1.8KW water heater so the max it can use between 0000-0100 is 1800kw. as being seen the the sensor readings itself.

This seems to happen every morning if the hot water is active over the midnight period.

This throws off the hot water calculations I have on the meter reading for daily hot water, weekly hot water, monthly hot water and yearly hot water that all use the Energy Hot Water as their source. And then the costs for each are calculated on that - so they are also off. Seems to be adding 7+ KW to start each day the hot water is on over the midnight timeslot…

Any ideas ?

How do you pull this data?

You could use helper to create a template sensor and limit the acceptable data input data

Is 6-7 kWh about what you use in a day? Seems plausible from the excerpt posted. There might be some corner case where if the heater is drawing power over midnight, the total re-adds the entire prior day’s worth of energy use (perhaps because it uses the previous day’s midnight as the start point for the incremental calculation?)

As the other response said, hard to know without more information about what is computing the total and how.

Its not what we use in a day - it seems to start about the 7 for some reason.
The sensor is correct - you can see the usage in the sensor screenshot.
You can see the energy jumps up within an hour of the first day.

The data is collected as there is a left Riemann helper on the hot water clamp - that creats the energy. I believe this is normal. Then there are multiple meter readers for Daily, weekly, monthly, yearly that all use the same energy sensor.

This is all normal and in use for other things I have - like peak power use and offpeak power use. Its ONLY the hot water that has this strange jump.

Please show your config for the energy sensor as its defined using the power clamp. Are you using a stats sensor or a utility meter?

Is your server’s time correct?

Here is the energy sensor -

Here is the utility meter for Daily Hote Water -

The timezone is correct.

I have not noticed an issue with time - all automatins fire at the correct time.

I use a mini PC with the home assistant os installed on it. Cant fine anywhere is the screens that confirms time, but I used to run the time/date intergration and that was always updating in the log at the correct time.

Thanks for the assist all.

The issue is the sensor, and the energy do not seem to go hand in hand - Here is today so far for example -

More info - I checked the start and end times for the hot water clamp sensor (screenshot above that you cant click on, but I did) and have this -

14/08 -

0000-0055 - 1800kw - 55mins
0135-0200 - 1800kw - 25mins
0315-0340 - 1800kw - 25mins
0520-0535 - 1800kw - 15mins
0630-0720 - 1800kw - 50mins
1110-1245 - 1800kw - 85mins
1305-1415 - 1800kw - 70mins
1500-1525 - 1800kw - 25mins
1645-1655 - 1800kw - 10mins

total minutes operational - 360mins - 6 hours
total KW used - 6 x 1800 = 10.8KW

Yet the daily HW utility meter says 14.81KW for today.
The Energy hot water goes from 4236 - 4250 - same 14KW as above.

I figured out how to show the time, opened terminal from sidebar and typed date - it is correct.

OK - a bit more info…
The energy dashboard for NOW is showing Energy Hot Water as 8.7KW.
That does not add up to the totals I did before from the actual sensor… But it it closer that the utility meter’s for Daily hot water are reporting.

There must be an issue with the utility meter here (I dont understand this as they are also pointing to the same Energy Hot Water).

Your HotWater clamp sensor monitors the power.

You use Riemann sum to sum the area under the power curve to give you energy.

You are, correctly, using the ‘Left Rule’. This is the only one that works for step-function changes like a power switch that turns on and off.

HA only records a sensor entity state change every time the value changes. At each change (update) point, HA has the last value (left) and the new value (right).

When your Hot Water goes on, the power state changes from 0 to 1800 Watts. The Riemann sum integration calculates the energy since the last state change, which is 0 (the left value at the last ‘off’) x the period (of being ‘off’).

When your Hot Water goes off, the power state changes from 1800 to 0 Watts. The Riemann sum integration calculates the energy since the last state change, which is 1800 (the left value) x the period (of being ‘on’).

The Hot Water energy sensor will therefore only update the energy used when the power goes off. At 01:00 the power goes off. The power last went on at 21:00, so the time period of the ‘power rectangle’ is 1.8 kW x 4 hours = 7.2 kWh.

This is exactly what the Reimann sum integration should do and that is correct.

The energy sensor will jump by 7+ kWh at 01:00.

Your daily utility meter will reset at 00:00, that is what it does, and is correct.

Utility meters are actually ‘billing period sensors’. The Utility Meter sensor holds the last value seen at the last reset, and provides the difference between the value now and the value at the last reset. If the reset is ‘daily’ then the utility meter will record the value of the energy sensor at midnight, and will then provide the difference in energy between now and last midnight.

Note that this value is the ‘billed’ energy, and is not the ‘used’ energy.

This means that the hot water power used from 21:00 to midnight is included in the following day. On a day to day basis, the values are correct as the amount ‘billed’ or ‘accounted for’ in the following day is roughly the same. What you use tonight between 21:00 and midnight will end up in ‘tomorrow’, which balances what you used ‘yesterday’ ending up in ‘today’.

It is what it is. It is all working as it should.

It might not be working as you expect or want it to, but that is another matter.

2 Likes

That is a very detailed answer. Thanks for that.

From your explanation, the weekly, monthly and yearly (and the special AGL one I created that goes from 7th to 6th each month to ‘match’ the bill cycle), should be correct therefore, as its only the daily that is ‘off’.

I will delete the daily utility meter, and the associated cost calculated from it then if this is the case - as that is pretty useless and has me wondering why so much hot water was being used.

I dont think this is common knowledge, maybe a warning on any daily utility meter should be shown.

Unfortunately, I had already gone into the dev tools/statistics, for the energy hot water and shown the outliers (many at 7 ish KW), then edited them all down to 1.8… What a pain!

Home Assistant is very powerful and does a great deal.

If there was one thing I would really like to change, it would be to rename the ‘Utility Meter’ integration / sensor to something else - Billing Account Record (BAR) as a suggestion.

Naturally everyone thinks it is a utility meter - it takes in something and shows a dial like the one in the house, that constantly updates to show how much you have used. WRONG.

It is an accounting recorder. Much as any accounts, there is a ‘cut off’ at which point everything processed is added to the daily/monthly bill. Other items (usage) may still be pending but not yet added. Just like my monthly accounts for my credit card, my accounts program holds the last reconciled date, and the last reconciled figure. What my credit card company charge me each month is not what I have spent on the card between the dates, but what has gone into the accounts between the billing dates.

The whole “power - energy - utility meter” business is a constant source of ‘fun’ and yes perhaps someone should write a big warning, and a big explanation. [I think they already have, and not everyone learns by reading the manuals first, and naturally as this is open and community, anyone can volunteer to write something …]

Now, if you had asked “how do I get a daily utility meter to record my use between midnight to midnight” that would be a different question.

Since HA is economical, it only captures and records state changes. Which are then used by the Reimann integration. Which is then used by the Utility meter.

What you really want is for the Reimann sensor to update just before midnight with the energy used, so that the daily utility meter will show the ‘correct’ full daily used energy. This requires HA to record the power state change at midnight, in this case from 1800 down to 0 (which then triggers the update of the energy sensor).

If you held the power sensor value at zero over midnight, it should all work as you want. This can be done by either turning the HotWater system off at 23:59 (and back on again at 00:01 if required) or by setting up a virtual power sensor that does the same for you, without actually turning the hot water off.

Say you had a HWPower sensor, that used the power sensor you already have, but forced or set the state value to 0 for one minute before midnight. This is not something I have tried, but I think could be done with a template sensor that matches the power sensor value, except for one minute to midnight when it returns 0. ‘Virtual’ power goes to 0, energy sensor updates, utility meter records the actual day use. Simple.

Edit - suggestion:

New template sensor, using the base power sensor you have, and the time integration sensor (which you may need to add - gives local time “hh:mm” updated every minute).

{% if states('sensor.time') != "23:59" %}
{{states('sensor.mb_solar_power')}}
{% else %}
    0
{% endif %}

to create a ‘virtual’ power sensor, used in the Reimann integration, which will cause an update of the power value at 23:59 in time for the daily utility meter reset.

A utility meter is correctly called a utility meter in HA. It’s when people choose a reset cycle is when the confusion begins.

There is normally no need to reset the utility meter. You can view hourly/daily/weekly/monthly/yearly consumption on a utility meter that never resets by looking at its statistics rather than its state. If you have multiple different utility meters with the same source but different reset cycles, then you are doing it wrong. Just have one utility meter, then add a “statistics graph card” to your dashboard, and in that card’s configuration you can choose to view hourly/daily/etc. results independent of when (or if) that meter actually resets.

For your Riemann sum issue, yes the behavior outlined above is correct in that the integral value updates when the source changes. Except that behavior (as of a few months ago) can also be changed to force the Riemann sum to update if it has been longer than a specified duration. That is what the “max sub interval” option is on the bottom of the settings image that was shared in an earlier post. Set this to 1 minute if you want to force the Riemann sum to update every minute, which will solve the issue around midnight.

1 Like

Cool.

I have set that integral sensor for energy hot water to have that 1 minute update.
I will re add the daily hot water utility meter now for Hot Water and re add to the dash.
Home Assistant - a learning curve we never get to the top of!

Thanks for all the assistance.

I woke up to a very accurate 2.19KW of hot water!

1 Like