Skip to content

Water freezes at 32°F. Every alert on this site fires at 40°F, while there is still time to act.

Leak and Freeze

Home Assistant recipes for leaks and freezes

Three automations every water sensor setup needs: wet, cold, and quiet. Copy them as they are or let the builder write yours.

Three automations cover a house's water sensors. The first fires when any leak sensor reads wet, and closes the main valve if you have one. The second fires when any temperature sensor stays below 40 degrees for 15 minutes. The third fires when any sensor stops reporting for 24 hours, because a dead sensor looks exactly like a dry floor. They use Home Assistant's current syntax, with triggers and actions.

Wet

A leak sensor in Home Assistant is a binary sensor with the moisture device class, on when it reads water. A state trigger watching every leak sensor for on catches any of them, and the alert names the one that fired.

Cold

A temperature sensor is a plain sensor with a number for its state. A numeric state trigger with below set to 40 fires when the reading crosses that line, and holding it for 15 minutes keeps one draft from waking anyone.

Quiet

When a battery dies or a sensor drops off the network, Home Assistant marks it unavailable. A state trigger for unavailable, held for 24 hours, turns that silence into a message.

Where the alert goes

The recipes use notify.notify, which sends to the first notifier Home Assistant finds. If you have more than one, swap in the one for your phone; the Home Assistant notifications page lists the choices, including notify.send_message.

The three automations for a typical house (9 leak sensors, 1 temperature sensor)

Written by the plan builder for its default house. Rename the entities to match your own devices, then paste into automations.yaml.

- alias: "Leak: a sensor is wet"
  mode: single
  triggers:
    - trigger: state
      entity_id:
        - binary_sensor.water_heater_leak
        - binary_sensor.washer_leak
        - binary_sensor.dishwasher_leak
        - binary_sensor.sink_1_leak
        - binary_sensor.sink_2_leak
        - binary_sensor.sink_3_leak
        - binary_sensor.toilet_1_leak
        - binary_sensor.toilet_2_leak
        - binary_sensor.ac_drain_leak
      to: "on"
  actions:
    - action: valve.close_valve
      target:
        entity_id: valve.main_water
    - action: notify.notify
      data:
        title: "Water detected"
        message: "{{ trigger.to_state.name }} is wet. The main water valve is closing."

- alias: "Freeze: a space is below 40 F"
  mode: single
  triggers:
    - trigger: numeric_state
      entity_id:
        - sensor.exterior_wall_temperature
      below: 40
      for:
        minutes: 15
  actions:
    - action: notify.notify
      data:
        title: "Freeze risk"
        message: "{{ trigger.to_state.name }} is at {{ trigger.to_state.state }} degrees. Open the cabinet doors and let a faucet drip."

- alias: "Watch: a water sensor went quiet"
  mode: queued
  triggers:
    - trigger: state
      entity_id:
        - binary_sensor.water_heater_leak
        - binary_sensor.washer_leak
        - binary_sensor.dishwasher_leak
        - binary_sensor.sink_1_leak
        - binary_sensor.sink_2_leak
        - binary_sensor.sink_3_leak
        - binary_sensor.toilet_1_leak
        - binary_sensor.toilet_2_leak
        - binary_sensor.ac_drain_leak
        - sensor.exterior_wall_temperature
        - valve.main_water
      to: "unavailable"
      for:
        hours: 24
  actions:
    - action: notify.notify
      data:
        title: "A water sensor is offline"
        message: "{{ trigger.to_state.name }} has not reported for 24 hours. Check its battery."

Want one for your own house? The sensor plan builder writes it for exactly the sensors you have.

Sources

  1. Home Assistant: Binary sensor (the moisture device class) Home Assistant, accessed October 25, 2026
  2. Home Assistant: Automation triggers Home Assistant, accessed October 25, 2026
  3. Home Assistant: Numeric state trigger Home Assistant, accessed October 25, 2026
  4. Home Assistant: Valve (valve.close_valve) Home Assistant, accessed October 25, 2026
  5. Home Assistant: Notifications Home Assistant, accessed October 25, 2026

Drafted with a language model on October 25, 2026 from the sources listed above, each opened that day. Every threshold and count on the page comes from the site's own code, held by a test. The editor samples pages after they publish; nothing here is an inspection of your house or advice from a licensed plumber or insurer.

Found an error? See Corrections.

Home Assistant recipes for leaks and freezes | Leak and Freeze