Water sensors and other alarm conditions

Was thinking about alarm type sensors, especially the water sensor I have. I currently have it set to send me an email message whenever the alarm triggers, and whenever it clears. But what about in the mean time?

I could have a script that continuously loops (say, every 15 minutes) until the alarm clears, or until after N announcements (say, 4 of those, so you get an hour’s worth of reminders) that the house is about to float away. But I don’t know if that’s the best direction to go. I don’t know if I want an endless loop like that, so maybe a loop with a break condition is best.

I could also see something like 1st alarm to me, 2nd alarm to me + wife, 3rd alarm to me + wife + neighbor or something like that.

What other ways have folks approached this topic?


I tend not to think too hard about it. This should be a rare event so the amount of effort put into it is minimal.

I have a very simple rule. When one of the water leak sensors changes to ON, I generate an an alert to me every minute until the sensor goes off.

Why every minute? Because I get lots of notifications and frequently don’t notice. Once per minute is guaranteed to get my attention.

But once I know the sensor is going off, the notification has done its job. In that case, I just disable the rule through MainUI.

Nothing fancy. Nothing complicated. OH can’t do anything about it. If no one is home, getting more alerts isn’t going to do anything but be annoying. If someone needs to be contacted, I’d do that myself and not rely on OH to do that. So I keep it nice and simple.

Thankfully I’ve only ever had to deal with this once.

1 Like

openHAB is event driven, best results are usually obtained by setting aside thoughts of loops and “every 15 minutes”. For delayed or repeated actions, use timers
Alarm triggers rule, sends first alert, sets up timer for 15 minutes hence.
The timer code checks if condition still true (else abort), re-issues notification(s), then reschedules itself for half-hour hence or whatever.

A simple state machine can escalate/steer the activity at each timer event.

1 Like

If you’d like to reduce the rate of notification, you can use exponential backoff.

I get a pushover message on my mobile, which I have to acknowledge in the app. Otherwice you get a sound on the mobile every 5 minutes.