Virtual counter (KWh) with reset function

Hello everyone,

I am trying to create a virtual counter in HA that has the following functions:

  • Adding all energy identities
  • Reset function

I have several identities that count kilowatt hours. Now this virtual counter should add the values ​​of the energy identities to the initial status and start again at 0 when I press the reset button.

To better understand what I want exactly:

Let’s assume the case where an energy identity currently has a status of 1.45 KWh and the virtual meter is currently at 0. Energy consumption increases the energy identity from 1.45 KWh to 1.47 KWh, so the virtual meter must now read 0.02 kWh standing. If I now press the reset button, the virtual meter starts again at 0. Now the energy identity changes again from 1.47 KWh to 2.47 KWh, so the virtual meter now reads 1.00 KWh.

I hope I was able to present my project in a comprehensible manner.

Can anyone show me how to do this in HA?

Thanks in advance.

Under which conditions will you press that button? Will you be automating this? If so, we’re probably just talking about a utility meter here.

I am happy to give you an example for pressing the reset button:

Let’s say I want to know what a washing machine program used in KWh and I want to convert that into euros.

So I press the reset button (virtual counter to 0) and then start the washing machine. When the washing machine is finished, the energy used for the washing machine program should appear in kWh on the virtual counter.

Currently, I laboriously write down the current status of the energy identity, start the washing machine and write down the status of the energy identity again after the end of the program. Then I have the KWh for the program I am currently using and then convert that into euros.

Remember to hit the reply on a post, otherwise I won’t get a notification.

You can still use a utility meter and have your button call the utility meter’s reset service.

But, perhaps get something like a Shelly PM and put it on the socket where the appliance is connected. You’d need one for every appliance/socket, so I’m not sure what you’re willing to spend.

Sorry. I was not aware of that.

And what you propose is a good idea, but not an elegant solution. I had actually hoped that I could somehow manage this - as already described - without resetting the energy etitity.

You’d need to point out to me exactly where you said this. I read through all the posts again now, and I specifically asked:

Can you elaborate?

Ok I’ll try to explain this now as precisely as possible what exactly I want:

I use so called smart plug adapters, which provide the following idetities (similar to the Shelly PM - I think):

  • Current consumption in watts (W)
  • Current in Ampere (A)
  • Total power consumption in kilowatt hours (KWh)

This plug is connected to a washing machine.

I can reset the identity “Total power consumption in kilowatt hours” by command, but this identity is still used for another calculation, so if I reset this identity every time, the other calculation will not work anymore.

If I now want to know how many kilowatt hours a washing machine process has used, I write down the identity “Total consumption in kilowatt hours” before starting the program. After the end of the program, I write down the status of the identity “Total consumption in kilowatt hours” again. Now I calculate manually the difference and have then a value X in KWh for the Waschmaschinenprogram just transacted.

Example:

State of the identity “Total consumption in kilowatt hours” before washing machine start: 2.47 KWh
Start of the washing machine program
End of the washing machine program
Status of the identity “Total consumption in kilowatt hours” after the end of the washing machine program: 3.90 KWh
Difference: 1,43 KWh
Thus, the washing machine program has used a total of 1.43 KWh.

Now, of course, I don’t want to calculate the totals manually each time and need a counter that I can reset to 0 by pressing a button to get the difference value.

I hope, I now understandable and comprehensible represented.

I think you’re misreading what I’m saying.

I’ve quoted myself, and asked a question on that point, which you haven’t answered. It’s called bottom posting.

I understand you currently do a manual reset (and/or a manual reading). I’ve given you a way to connect a utility meter to a button, which will achieve exactly that. Yet, you say that you want to remove this manual step, but give no indication of how you’d do that (like, whether there are some rules you have in mind).

So here in now my solution:

1 Like

You could’ve created a vastly simplified setup if you followed my advice. Did you even try to understand how utility meters work? You literally just had to give one your consumption sensor and tie a button the its reset function. It can even handle the tariffs for you.