Moisture level
The Moisture level condition passes when a moisture reading meets a threshold you define. You can check that the moisture content is above, below, within, or outside a specific range. It works with sensors that have the moisture device class, such as soil moisture probes. Use it to run an automation only when a plant’s soil is dry enough to need water, or only when material is wet enough to need drying.
Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.
Using this condition from the user interface
If you prefer building automations visually, Home Assistant walks you through this condition step by step. You pick what to check, tweak a few options, and save. No YAML knowledge required.
To use Moisture level in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the And if section, select Add condition.
- Select what you want to check. Under By target (see Targets), pick a moisture sensor (for example, a soil moisture probe). You can also select an area, a device, or a label.
- From the conditions shown for that target, select Moisture level.
- Under Threshold type, set the moisture level the condition checks against:
- Pick whether the reading must be Above, Below, In range, or Outside range of the threshold.
- Select Number or Entity:
-
Number: Enter a fixed percentage directly, for example
25for 25%. For In range or Outside range, enter both a lower and upper bound. -
Entity: Use a sensor entity or a number helper entity as the threshold.
- If you don’t have a number helper, you can create one by selecting Create a new number helper.
-
Number: Enter a fixed percentage directly, for example
- Under Condition passes if (see Behavior), pick Any or All.
- Under For at least, set how long the reading must meet the threshold before the condition passes.
- Select Save.
Options in the UI
The moisture level the entity has to meet for the condition to pass. Above and Below are exclusive: a reading equal to the threshold does not pass. In range is exclusive at both bounds. Outside range is inclusive: a reading equal to either bound passes. Choose Number to enter a fixed percentage (0–100), or Entity to use a sensor or number helper as a dynamic threshold.
When multiple entities are targeted, controls how results combine:
- Any: The condition passes if at least one targeted entity meets the threshold (default).
- All: The condition passes only when every targeted entity meets the threshold.
Using this condition in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this condition as moisture.is_value. A basic example looks like this:
condition: moisture.is_value
target:
entity_id: sensor.fiddle_leaf_soil_moisture
options:
threshold:
type: below
value:
number: 25
This passes when the fiddle leaf fig’s soil moisture is below 25%.
To check that soil moisture is within a healthy range:
condition: moisture.is_value
target:
entity_id:
- sensor.tomato_soil_moisture
- sensor.basil_soil_moisture
options:
threshold:
type: between
value_min:
number: 40
value_max:
number: 70
behavior: all
This passes when both plant soil sensors read between 40% and 70%.
To use a number helper as a dynamic threshold that you can adjust without editing the automation:
condition: moisture.is_value
target:
entity_id: sensor.fiddle_leaf_soil_moisture
options:
threshold:
type: below
value:
entity: input_number.plant_dry_threshold
Options in YAML
The moisture level the entity has to meet for the condition to pass:
-
type: above(exclusive): Sets a minimum. The reading must be strictly above the threshold to pass. Providevaluewith anumberkey (0–100) or anentitykey. -
type: below(exclusive): Sets a maximum. The reading must be strictly below the threshold to pass. Providevaluewith anumberkey (0–100) or anentitykey. -
type: between(exclusive): Defines a range. The reading must be strictly between both bounds to pass. Providevalue_minandvalue_max, each with anumberkey or anentitykey. -
type: outside(inclusive): Defines an outside-range. The reading must be at or beyond either bound to pass. Providevalue_minandvalue_max, each with anumberkey or anentitykey.
For the number key, use a percentage value (0–100). For the entity key, use an input_number, number, or sensor entity.
When multiple entities are targeted, controls how results combine:
-
any(Any in the UI, default): passes if at least one targeted entity meets the threshold. -
all(All in the UI): passes only when every targeted entity meets the threshold.
Targets of the condition
This condition requires a target. The target is the object that Home Assistant will check. You can point the condition at a single entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more], a device, an area, a floor, or a label, and Home Assistant will evaluate every matching moisture entity behind that target.
-
Entity: one specific moisture entity, such as
moisture.living_room. - Device: every moisture entity that belongs to a device.
- Area: every moisture entity in a room or area.
- Floor: every moisture entity on a floor.
- Label: every moisture entity that shares a label.
You can also select different target types in one condition. For example, you can add a specific entity and an area as targets in the same condition to check both of them at once.
Behavior with multiple targets
When you target more than one entity (or select an area, floor, or label that contains several), the Condition passes if option controls how the results combine:
- Any (default): the condition passes if at least one of the targeted entities matches. For example, if you check three smoke sensors and only one of them detects smoke, the condition still passes. This is useful for questions like “is there smoke anywhere in the house?”
- All: the condition passes only when every targeted entity matches. For example, if you check the same three smoke sensors, the condition passes only once all three report cleared. This is useful for “is the entire house safe now?” checks, so your automation does not send an all-clear while one room still has a reading.
Good to know
- This condition works with sensors that have the moisture device class, such as soil moisture probes. For wet/dry leak sensors, use Moisture is detected or Moisture is not detected instead.
- Entities that are
unavailableorunknownare skipped for Any and fail for All. - When you use a sensor as a dynamic threshold, its value is read at the moment the condition runs. The threshold is not continuously tracked; it is re-evaluated each time the automation runs.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, open an automation, and add this condition. Trigger the automation with and without the condition met, and watch whether it continues or stops.
More examples
Real scenarios where this condition gates an automation. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: only water plants when the soil is dry
When the daily watering schedule runs, only activate the pump if the soil moisture is below 30%, so you don’t overwater after a rainy day.
- Trigger: Time: 08:00
-
Condition: Moisture level (below 30%)
- Target: Tomato soil moisture sensor
-
Action: Turn on switch
- Target: Plant watering pump
YAML example for a watering routine guarded by soil moisture
alias: "Water tomatoes only when soil is dry"
triggers:
- trigger: time
at: "08:00:00"
conditions:
- condition: moisture.is_value
target:
entity_id: sensor.tomato_soil_moisture
options:
threshold:
type: below
value:
number: 30
actions:
- action: switch.turn_on
target:
entity_id: switch.plant_pump
- delay: "00:00:10"
- action: switch.turn_off
target:
entity_id: switch.plant_pump
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the condition you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain conditions or suggest the right one when you describe what you want in plain language.
Related conditions
These conditions work well alongside this one:
-
Moisture is detected: Tests if one or more moisture sensors are detecting moisture.
-
Moisture is not detected: Tests if one or more moisture sensors are not detecting moisture.