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.

Labs

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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the And if section, select Add condition.
  4. 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.
  5. From the conditions shown for that target, select Moisture level.
  6. Under Threshold type, set the moisture level the condition checks against:
    1. Pick whether the reading must be Above, Below, In range, or Outside range of the threshold.
    2. Select Number or Entity:
      • Number: Enter a fixed percentage directly, for example 25 for 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.
  7. Under Condition passes if (see Behavior), pick Any or All.
  8. Under For at least, set how long the reading must meet the threshold before the condition passes.
  9. Select Save.

Options in the UI

Threshold type

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.

Condition passes if

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.
For at least

How long the reading must meet the threshold before the condition passes. The default is 0 (passes immediately).

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:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
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:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
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:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
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

threshold map Required

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. Provide value with a number key (0–100) or an entity key.
  • type: below (exclusive): Sets a maximum. The reading must be strictly below the threshold to pass. Provide value with a number key (0–100) or an entity key.
  • type: between (exclusive): Defines a range. The reading must be strictly between both bounds to pass. Provide value_min and value_max, each with a number key or an entity key.
  • type: outside (inclusive): Defines an outside-range. The reading must be at or beyond either bound to pass. Provide value_min and value_max, each with a number key or an entity key.

For the number key, use a percentage value (0–100). For the entity key, use an input_number, number, or sensor entity.

behavior string

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.
for string

How long the reading must meet the threshold before the condition passes. Accepts a duration string in HH:MM:SS format.

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 unavailable or unknown are 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.

Tip

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
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
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.

Tip

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: