Illuminance

The Illuminance condition passes when a light level reading meets a threshold you define. You can check that the illuminance is above, below, within, or outside a specific range. It works with sensors that have the illuminance device class. Use it to only dim a lamp when the room is already bright, only close the blinds when the patio is in direct sun, or only run an evening routine once a room has actually gotten dark.

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 Illuminance 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 an illuminance sensor. You can also select an area, a device, or a label.
  5. From the conditions shown for that target, select Illuminance.
  6. Under Threshold type, set the light 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 value in lux, for example 500 for an office level. 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 light 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 value in lux, 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 illuminance.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: illuminance.is_value
target:
  entity_id: sensor.office_illuminance
options:
  threshold:
    type: below
    value:
      number: 200

This passes when the office illuminance is below 200 lx.

To check that ambient light is within a comfortable reading range:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
condition: illuminance.is_value
target:
  entity_id:
    - sensor.office_illuminance
    - sensor.study_illuminance
options:
  threshold:
    type: between
    value_min:
      number: 300
    value_max:
      number: 750
  behavior: all

This passes when both illuminance sensors read between 300 lx and 750 lx.

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: illuminance.is_value
target:
  entity_id: sensor.living_room_illuminance
options:
  threshold:
    type: below
    value:
      entity: input_number.comfort_brightness_threshold

Options in YAML

threshold map Required

The light 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 (lux value) 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 (lux value) 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 value in lux. For the entity key, use an input_number, number, or sensor entity.

behavior string

When multiple entities are targeted, controls how results combine:

  • any (default): passes if at least one targeted entity meets the threshold.
  • all: 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 illuminance entity behind that target.

  • Entity: one specific illuminance entity, such as illuminance.living_room.
  • Device: every illuminance entity that belongs to a device.
  • Area: every illuminance entity in a room or area.
  • Floor: every illuminance entity on a floor.
  • Label: every illuminance 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

  • Illuminance is measured in lux (lx). For reference: a brightly lit office is around 500 lx, indirect daylight is several thousand lx, and direct sunlight can exceed 100,000 lx.
  • This condition works with sensors that have the illuminance device class. For binary light/dark sensors, use Light is detected or Light 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 turn on the desk lamp when the office is dark

When the work-from-home schedule starts at 09:00, only turn on the desk lamp if the office is currently below 200 lx, so the lamp doesn’t turn on when daylight already lights the room.

  • Trigger: Time: 09:00
  • Condition: Illuminance (below 200 lx)
    • Target: Office illuminance sensor
  • Action: Turn on light
    • Target: light.desk_lamp
YAML example for a desk lamp guarded by ambient light
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Desk lamp on at 09:00 only if office is dark"
triggers:
  - trigger: time
    at: "09:00:00"
conditions:
  - condition: illuminance.is_value
    target:
      entity_id: sensor.office_illuminance
    options:
      threshold:
        type: below
        value:
          number: 200
actions:
  - action: light.turn_on
    target:
      entity_id: light.desk_lamp

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: