Skip to content

Instantly share code, notes, and snippets.

@TurtleFX
Forked from bbbenji/leak-detector-notifier.yaml
Last active December 19, 2024 14:27
Show Gist options
  • Save TurtleFX/213bd28f5cfb1a7cded5eb2e91aa30b8 to your computer and use it in GitHub Desktop.
Save TurtleFX/213bd28f5cfb1a7cded5eb2e91aa30b8 to your computer and use it in GitHub Desktop.
blueprint:
name: Leak detection & notification
description: Send a notification when any configured moisture sensor becomes moist
domain: automation
input:
actions:
name: Actions
description: Notifications or similar to be run. Use {{ trigger.event.data.new_state.attributes.friendly_name }} in a message for a friendly name of the sensor.
selector:
action: {}
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:
- choose: []
default: !input 'actions'
mode: single
@TurtleFX
Copy link
Author

TurtleFX commented Jun 26, 2022

Modified version of the Leak detection & notifier blueprint.
Actions can be chosen freely, e.g. to call a service for email notification. Also, several actions can be added. Used Low battery level detection blueprint as example for this action.

@Mrsash2020
Copy link

Thanks for the blueprint. Very useful. Can I suggest an exemption please. So I added 4 leak sensors. Kitchen, Bathroom, toilet and Aquarium. I have your blueprint initiating a water valve turn off cutting off mains water and notification which works perfectly.

The Aquarium leak sensor I added is non critical and need it exempt from it. I am trying to figure out how to manually edit the blueprint but not sure I am getting it since very new to Home assistant let alone YAML.

So if you are not keen on adding this, can I confirm which one would work?

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" }}"

  • condition: not
    conditions:

    • type: is_moist
      condition: device
      device_id: XXXXXXXXXXXX
      entity_id: YYYYYYYYYYYY
      domain: binary_sensor
  • condition: and
    conditions:

    • condition: not
      conditions:
      • type: is_moist
        condition: device
        device_id: XXXXXXXXXXXX
        entity_id: YYYYYYYYYYYY
        domain: binary_sensor

@mukul-k
Copy link

mukul-k commented Dec 1, 2024

Is there a way to modify this to tell you which sensor triggered it like the original blueprint?

Thanks!

@patienttruth
Copy link

Is there a way to modify this to tell you which sensor triggered it like the original blueprint?

Thanks!

@mukul-k, the solution is in the description.

@mukul-k
Copy link

mukul-k commented Dec 19, 2024

Is there a way to modify this to tell you which sensor triggered it like the original blueprint?
Thanks!

@mukul-k, the solution is in the description.

totally missed that! thanks!

@patienttruth
Copy link

Is there a way to modify this to tell you which sensor triggered it like the original blueprint?
Thanks!

@mukul-k, the solution is in the description.

totally missed that! thanks!

You're welcome!

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