I am receiving rain data from my weather station via rtl_433. All is going well except for the fact that the station only reports the accumulated rain since it was last powered on (491.8mm currently).
I want to create a sensor that resets to 0.0mm at midnight each day and then increments if/when my rain sensor (sensor.bresser_6in1_0_860321798_rain_total) value increases.
An example would be:
sensor.bresser_6in1_0_860321798_rain_total starts at 491.8mm and sensor.rainfall_accumulated_change starts at 0mm.
sensor.bresser_6in1_0_860321798_rain_total increases to 492.8mm, then sensor.rainfall_accumulated_change new value should be 1mm.
sensor.bresser_6in1_0_860321798_rain_total then increases from 492.8mm to 592.8mm, therefore sensor.rainfall_accumulated_change new value should be 101mm.
I hope this makes sense.
I tried this in the template editor, including changing the state of sensor.bresser_6in1_0_860321798_rain_total from 491.8 to 492.8 beforehand:
Thank you, I had considered this but assumed that whilst utility Meter would start at 0 the value would jump to the total accumulated rain, e.g. 492.8, as soon as rainfall is detected.
The helper only updates when changing from one number to another. Changing from unknown to a number (like when the helper is first created) does nothing.
And the helper only accumulates changes in value.
So…
at helper creation, unknown → 492.8 : do nothing but note the current value internally, output set to 0
0.2mm of rain occurs, 492.8 → 493.0, output set to 0.2