(solved) Read variable only from certain time range

hello forum,

i am new to the HA use and forum. I have installed HA on my PI4 and got most of my systems working. i followed video and text guides. i use many homematic devices. my question is: the homematic weather station has a rain counter. this counter adds the daily rain. i dont want so reset it every day and i thought it must be possible to read the value from a certain time until now.

can i create a new sensor which reads the rain from 00:00 AM until NOW?

thank you

Why not just automate resetting it at midnight?

If I understand correctly you have a sensor that accumulates the total rainfall forever (always increases and never resets) and you want to track only the difference in rainfall from midnight till now?

if that is correct then I think the easiest way would be to create an automation to store the total rainfall amount at midnight into an input_number and then create a template sensor that subtracts the value of the input_number from the current rainfall sensor value.

That would give rainfall since the previous midnight.

I think.

A utility meter with a daily cycle fed from the total rainfall sensor would be easier.


thank you for your input, i will test it out and give a short reply…i hoping to have time this week.

@tom_l i dont want so reset, so i can track the rain on a longer period like how much rain this year / month etc.

a utility meter is the way to go, i use loads of them to track various things not just utilities.

i use them to track internet downloads/uploads, electricity, gas, water, pretty much anything that counts up…

for rain you could setup several utility meters, one for hourly, one for daily, monthly and annual.

the main rain sensor will continue to count up and up, but the extra sensors will reset each day or month… whatever you set


thanks for your help, today i finally found time to try it. i have read that it need one full day or full month to work…made a daily and a monthly sensor for rain, from my homematic rain station. followed a video guide on youtube…easy!

thanks a lot!