-
-
Save colmbuckley/9cf05ef2fd8759268a71f8e3fd16de16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Leak detection & notifier | |
description: Send a notification when any configured moisture sensor becomes moist | |
domain: automation | |
input: | |
actions: | |
name: Actions | |
description: Notifications or similar to be run. {{ trigger.event.data.new_state.attributes.friendly_name }} will be the sensor name. | |
selector: | |
action: {} | |
variables: | |
sensors: >- | |
{% set result = namespace(sensors=[]) %} | |
{% for s in states.binary_sensor | selectattr('attributes.device_class', '==', 'moisture') | selectattr('state', '==', 'on') %} | |
{% set result.sensors = result.sensors + [s.name] %} | |
{% endfor %} | |
{{result.sensors | join(', ')}} | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment