Hello all,
I am still beginner in the Home Assistant ecosystem development. And although there is a lot of high quality documentation, it is a bit overwhelming at this state.
What am I trying to do ?
I have several sensors that are incrementing continuously (for instance energy sensor for my electric plugs, water consumption from the ai-on-the-edge, and so on…).
So they give my an absolute value that is kind of useless. On the energy dashboard, I can read out the last hourly value, daily value and with a bit of manipulation, analyse the value over different time periods. That’s fine but I want a more user friendly way to analyse a sensor value over a given user defined period. A bit like a stopwatch for time:
I would like a sensor that has a button to reset the “start value” beeing equal to the current sensor value, and a sensor value that returns the difference between the current sensor value - start value.
An example may be more easy to understand. Let’s take my water consumption sensor. And let’s say I want to know how many liters of water I’ll use to water my lawn.
First step: I clic on the reset button. The start value is set to the current value of my water consumption sensor. The difference of the current value and the start value si zero.
Second step: I go do my things… In this case water my lawn.
Third step: when finished watering, I come back to my dashboard where I can read out the volume of water I have used as the difference of the current water consumption sensor value and the start value.
This value will also continuously grow, but I can manually reset it when ever I want to. It could also be reset by any event triggered automation I could come up to…
My problem is: I don’t know where to start…
I imagine creating a new helper something to create a variable that will store the “start value”
I also will need a button to trigger the copy of the current sensor value to the star vakue variable.
An finally I need some dashboard fiddling to display the difference sensor current value - start value…
I understand my question is a bit like a green-field, vaste and open… But every help and kickstart solution is more than welcome.
Thank you all in advance,
J. Kurz