Skip to content

Instantly share code, notes, and snippets.

@wied03
Last active October 4, 2021 03:24
Show Gist options
  • Select an option

  • Save wied03/64dc7f7c0993c10a70ee35fccb5c1a9d to your computer and use it in GitHub Desktop.

Select an option

Save wied03/64dc7f7c0993c10a70ee35fccb5c1a9d to your computer and use it in GitHub Desktop.
blueprint:
name: Water main shutoff
description: Shutoff water main when there is a leak
domain: automation
input:
water_cutoff_target:
name: Water cutoff valve
selector:
target:
entity:
domain: switch
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:
service: switch.turn_off
target: !input water_cutoff_target
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment