Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
blueprint:
name: Leak detection & notifier
description: Send a notification when any configured moisture sensor becomes moist
domain: automation
input:
notify_device:
name: Notify device
description: "The device where the notification should be sent to."
selector:
device:
integration: mobile_app
trigger:
- event_data: {}
event_type: state_changed
platform: event
condition:
- condition: template
value_template: '{{ trigger.event.data.new_state.attributes.device_class == "moisture" }}'
- condition: template
value_template: '{{ trigger.event.data.new_state.state == "on" }}'
action:
domain: mobile_app
type: notify
device_id: !input notify_device
message: "{{ trigger.event.data.new_state.attributes.friendly_name }} has detected a leak."
title: "Leak detected!"
mode: single
@the1snm
Copy link

the1snm commented Apr 23, 2021

Enjoy the blueprint thank you, noticed it was erroring out for me because line 27 should be: "device_id: notify_device". There is also a small typo in line 28 deteced should be detected.

@bbbenji
Copy link
Author

bbbenji commented Jul 7, 2021

Thanks for the typo fix @the1snm!

As for the !input error you’re are getting, I have no idea why… It’s a valid tag and required for it to be configurable. See: Blueprint tutorial - Home Assistant 10

@djbr22
Copy link

djbr22 commented Aug 24, 2021

Just wanted to say thanks for the great blueprint! It works perfectly on all my water sensors. I also included a link to it at the bottom of guide here as a way to say thanks. :) I just refreshed the cache on the page so hopefully it shows up for you. https://smarthomepursuits.com/add-a-blinking-leak-sensor-card-to-home-assistant/

@Ljiddou
Copy link

Ljiddou commented Dec 23, 2021

Thanks for the blueprint and its working perfectly. I'm trying to add critical push alert for IOS but its not working. I'm adding it at the end of the blueprint but no luck. This is what I have:

action:
domain: mobile_app
type: notify
device_id: !input notify_device
message: "{{ trigger.event.data.new_state.attributes.friendly_name }} has detected a leak."
title: "Leak detected!"
push:
sound:
name: "default"
critical: 1
volume: 1.0
Sorry I'm all new to home assistant and still learning.

@SergeantPup
Copy link

SergeantPup commented Jan 16, 2022

Hello, I just came here to say thank you and that it works perfectly. I was sweating the conversion from hubitat with 30 leak sensors because they have an easy tool that does this. It indicates the sensor name in the notification which was crucial. This was the first leak solution I found and actually the first blueprint I used and it was an easy/awesome experience.

I'm just saying this to josh ya, but did you have to use the word moist? lol "Send a notification when any configured moisture sensor becomes moist"
Again, thank you for the excellent leak aggregator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment