Bench answer
The reliable starting point
Start with a listed leak sensor, a loud local alert and a phone notification that names the exact location and time. Add automatic shutoff only after a qualified installer confirms that a rated, normally appropriate valve can close without creating hazards for heating, fire suppression, medical equipment, sanitation or occupants. Preserve a reachable manual override, verify the valve’s reported state after the command, and escalate when confirmation is absent. This is damage-mitigation automation, not a certified flood or life-safety system.
Map the water system before writing an action
List incoming water, branch valves, hot-water equipment, heating loops, pumps, irrigation, fire suppression and any appliance whose safe operation depends on supply. Identify who may be affected by an automatic closure and how they can restore service. A main-valve command that is sensible in one home can be unsafe in a building with shared systems or equipment that must not run dry.
Ask a qualified plumber or relevant specialist whether the proposed actuator and valve are rated for the pipe, pressure, potable-water use, duty cycle and installation environment. The automation guide cannot establish those facts. Keep the manufacturer’s manual handle or approved manual method physically reachable, label it, and make sure household members know that reopening before inspection may release more water.
Place sensors for early evidence and maintain them
Place leak sensors at the lowest plausible water path near washing machines, dishwashers, sinks, toilets, water heaters and vulnerable plant rooms without blocking drainage or creating a trip hazard. A sensor detects moisture only where water reaches its contacts. One device in the center of a large room does not prove the perimeter is dry.
Name each entity by physical location, not by a generic product label. Verify the normal and wet states in Home Assistant and the device integration documentation. Add low-battery and unavailable monitoring. Test with the manufacturer-approved method and dry the sensor completely afterward. Do not pour water where electricity, finishes or equipment could be damaged merely to exercise an automation.
For high-consequence locations, independent sensors can improve evidence, but do not hide disagreement. A “two sensors must agree” rule may delay response when only one is reached. Instead, let either sensor raise an immediate alert; reserve additional evidence for deciding whether an approved automatic valve action is permitted.
Make the first action an unmistakable alert
The first safe layer is notification. Include the sensor’s human location, detected state, timestamp and a link to a focused dashboard. Send to more than one responsible device where possible and activate a local sounder that does not depend on a phone, internet service or sleeping notification policy. Avoid alarm fatigue: maintenance and damp-cleaning tests should be planned, labeled and cleared.
Use trigger IDs or a separate recovery automation so “wet,” “sensor unavailable” and “dry again” produce different messages. A dry state is not proof that damage has stopped; the water may have moved beyond the sensor. The recovery message should say that the sensor cleared and that a person must inspect before any valve is reopened.
alias: "Utility room — leak alert"
triggers:
- trigger: state
entity_id: binary_sensor.utility_leak
to: "on"
actions:
- action: notify.mobile_app_house_admin
data:
title: "Water detected — utility room"
message: "Inspect now. Do not reopen a closed valve before the source is safe."
- action: siren.turn_on
target:
entity_id: siren.indoor_warning
mode: single
Put automatic shutoff behind explicit guards
Only add valve.close_valve after the hardware and system are approved for automatic closure. The automation should target one explicit entity and reject unknown or unavailable inputs. Consider a helper that represents “automatic water shutoff armed,” a maintenance bypass that expires visibly, and conditions for equipment that must be stopped safely before supply closes. Never infer that a broad area target contains only the intended valve.
After sending the close action, wait for the valve entity to report closed within a realistic timeout. A successful service call means the command was accepted, not that the pipe is isolated. If confirmation does not arrive, raise a higher-priority alert that says manual intervention is required. Do not repeat commands indefinitely; retries can mask a jam, drain a battery or congest a network.
Reopening should be manual after a person identifies and isolates the source, checks the affected equipment and stands near the valve. An actionable notification may navigate to instructions, but a lock-screen “Open” button is too easy to trigger accidentally. Keep automatic reopen out of the routine.
- action: valve.close_valve
target:
entity_id: valve.approved_main_water
- wait_template: "{{ is_state('valve.approved_main_water', 'closed') }}"
timeout: "00:00:30"
continue_on_timeout: true
- if: "{{ not wait.completed }}"
then:
- action: notify.mobile_app_house_admin
data:
title: "Valve closure not confirmed"
message: "Use the labeled manual shutoff and inspect the leak."
Design for lost power, radio and Home Assistant
Decide what the valve does when power fails and verify the manufacturer’s documented behavior; do not assume “normally closed” from an entity name. A motorized valve may stop mid-travel, retain position or require local power to report. Radio loss can leave Home Assistant showing an old state. Use the device’s physical position indicator where available and keep manual access clear.
A local sounder and phone both have failure modes. Test with internet disconnected, a phone in Do Not Disturb, Home Assistant restarting and the sensor integration unavailable. Important notifications may require platform-specific channels and permissions, but even correctly configured mobile delivery is not guaranteed. This is why an ordinary inspection and manual shutoff remain part of the response.
Document the response on paper near the shutoff: who to contact, which equipment to stop, how to close manually and what must be checked before reopening. Automation should shorten the path to a safe human decision, not make the system incomprehensible when the screen is dark.
Commission with dry tests and supervised drills
First test the notification with a harmless test helper or the automation editor’s individual action runner. Then use the sensor manufacturer’s approved test procedure while a second person observes the valve and manual control. If automatic closure is enabled, isolate or protect affected equipment as directed by the qualified installer. Confirm the physical valve position, entity state, timeout branch and escalation message.
Repeat a drill after firmware, plumbing, radio or notification changes. Log the sensor test date and valve exercise recommended by the manufacturer. Replace batteries before they become unreliable. Treat a test that produced a notification but no physical confirmation as a failed test, not a partial success.
Leak-response acceptance checklist
- Every sensor location and wet/unavailable state is verified.
- A local alert and responsible phones receive a clear location.
- Any automated valve is rated and approved for this exact system.
- Closure is physically and electronically confirmed or escalated.
- Manual shutoff, inspection and no-automatic-reopen rules are documented.
Source desk
Primary documentation used for this guide. Interface names and behaviors can change; confirm the current page before changing a live installation.
- Valve actionsOfficial Home Assistant action catalogue, including valve closure.Official source ↗
- Script waits and timeoutsOfficial wait, timeout and branching behavior.Official source ↗
- Automation troubleshootingOfficial action testing and trace workflow.Official source ↗
- Companion notification basicsOfficial mobile notification service and delivery setup.Official source ↗
Source review completed .
Frequent questions
Can Home Assistant automatically close a water valve after a leak?
Technically it can call a supported valve action, but only use automatic closure after qualified review confirms the rated valve and the water system can be closed safely. Preserve manual control and verify the physical result.
Should the automation reopen the valve when the sensor dries?
No. A dry sensor does not prove the source is repaired or the affected equipment is safe. Reopen manually only after inspection, with a person present at the system.
Is a smart leak sensor a certified flood alarm?
Do not treat it as one. Sensors, radios, Home Assistant and mobile notifications can fail. This pattern is damage-mitigation support and does not replace required certified safety systems or inspection.
What if the valve command succeeds but the state stays open?
Escalate immediately to manual intervention. A service response is not physical proof. Use a bounded timeout, notify the responsible person and follow the labeled manual-shutoff procedure.
Is one leak sensor enough for a whole room?
Usually not. A sensor detects moisture only where water reaches it. Place devices along plausible leak paths, maintain batteries and test each location using a safe manufacturer-approved method.