Files
Home-Assistant/blueprints/automation/local/tank_full_interlock.yaml
T

74 lines
1.9 KiB
YAML
Raw Normal View History

blueprint:
name: Tank full - outlet interlock and verified notification
description: >-
Request outlet shutdown when a tank is wet, including attempts to turn it
back on, startup and recovery. Verify the outlet reports off before claiming
success. Retry unconfirmed shutdowns every five minutes while wet.
domain: automation
input:
moisture_sensor:
name: Tank moisture sensor
selector:
entity:
domain: binary_sensor
outlet:
name: Protected outlet
selector:
entity:
domain: switch
title:
name: Alert title
selector:
text: {}
equipment_name:
name: Equipment name for the notification
selector:
text: {}
variables:
outlet: !input outlet
equipment_name: !input equipment_name
triggers:
- trigger: state
entity_id: !input moisture_sensor
to: 'on'
id: wet
- trigger: state
entity_id: !input outlet
to: 'on'
id: outlet_on
- trigger: homeassistant
event: start
id: startup
- trigger: event
event_type: automation_reloaded
id: reload
- trigger: time_pattern
minutes: '/5'
id: retry
conditions:
- condition: state
entity_id: !input moisture_sensor
state: 'on'
- condition: template
value_template: "{{ trigger.id != 'retry' or not is_state(outlet, 'off') }}"
actions:
- action: switch.turn_off
continue_on_error: true
target:
entity_id: !input outlet
- wait_template: "{{ is_state(outlet, 'off') }}"
timeout: '00:00:10'
continue_on_timeout: true
- action: script.notify_events_alerts
data:
title: !input title
message: >-
{{ equipment_name }} tank sensor detected water.
{% if is_state(outlet, 'off') %}
The outlet reports off.
{% else %}
Shutoff could not be confirmed (outlet state: {{ states(outlet) }}).
Check the equipment and outlet.
{% endif %}
mode: restart