Can't figure out how to use a template helper for a rain sensor

Hi everyone, I really need some help figuring out why my helper does not work. This is my Situation:
I have a rain gauge, that sends a steadily increasing rain_total value via MQTT. I want to create a helper based on that value, that shows if it is currently raining or not to use it in automations (closing roof windows, etc.). I figured a template should work and testing the template in the developer tools worked well. However, when using this template within a helper, it never updates and is therefore useless. The helper was created via the UI. What am I doing wrong?

Thanks for your help!

Btw, this is my template:
“{{ as_timestamp(now()) - as_timestamp(states.sensor.schou_72543_53632_rain_total.last_changed) < 300 }}”


I believe you should remove the "".

But what happens when you reload the integration to the rain meeter or restart HA.
Will it update the value?
Just thinking if that is a loop hole that will cause automations to run

This is probably a better binary sensor to use:

There are examples of detecting rising values at the end of the page.

Hi, thanks for your reply. I will try to remove the quotes. The system has been restarted, that did nothing.

I will have a look at that, thank you!

I didn’t mean the binary sensor should start working because of a restart.
I mean will the states.sensor.schou_72543_53632_rain_total.last_changed value change.
This could cause the binary sensor to go on.

Ah, sorry I misunderstood. Yes, a restart would probably trigger the rain sensor and subsequently the automations too. I didn’t consider that

You need to try what Tom suggested then and see how that reacts to a restart when it’s not raining.
Or perhaps you need to add to the existing template something with HA uptime. But I guess a integration reload will also cause issues, but that perhaps doesn’t happen as often.
Or try a triggered binary sensor that compares this value with the previous value