Hi all. I need to setup an automation with the following requirements. The base goal is to have HA contact me (e-mail and sms) if my sump pump doesn’t run at least every 30 minutes. Every time it runs, the counter should reset. It’d be great if I can take a picture from the web cam periodically. Bonus points to include a pic in the message.
I have a yolink vibration sensor that works great and accurately detects a run event.
I see that @Blacky has a few BPs that have very similar plugins with overlapping features that would probably fit here. I just need a push in the right direction and assistance with the logic flow where the action is to reset the timer or send a message.
Yessir. It’s not so much the integrations as the logic I can’t seem to figure out. I thought perhaps a blueprint might have this reverse logic plus timer encapsulated.
The crux of the problem is that it’s both event driven and timed and I really don’t understand the HA automation process enough to figure out how to link an event listener (vibration detected) to a timer (while timer < 30 mins)
For those in need of a solution, I used AI to give me a head start. I can’t say the logic is thoroughly tested, but it compiles and and test runs fire when expected.
To summarize:
Every 30 minutes, check if the sump vibration sensor state changed in the last 30 minutes. If so, set an HA notification, send an app notification, send an e-mail. Not included here, NOTIFIER_SMTP has three recipients, my e-mail, wife’s e-mail, my SMS e-mail address so I get an SMS text via SMTP also. This is way easier than setting up an SMS integration and most carriers offer this service.
alias: Sump Vibration Checker
description: >-
If the sump vibration sensor isn't triggered at least once every 30 minutes,
send notifications.
trigger:
- platform: time_pattern
minutes: /30
condition:
- condition: template
value_template: >-
{{ (now() - state_attr('binary_sensor.sump_vibration',
'last_changed').as_timestamp()) / 60 > 30 }}
action:
- action: persistent_notification.create
metadata: {}
data:
message: Sump sensor has not been triggered in 30 minutes.
title: Sump Sensor Alert
- action: notify.notify
metadata: {}
data:
message: Sump sensor has not been triggered in 30 minutes.
title: Sump Sensor Alert
- action: notify.NOTIFIER_SMTP
metadata: {}
data:
title: Sump Sensor Alert
message: Sump sensor has not been triggered in 30 minutes.
mode: single