Numeric state
The Numeric state condition checks whether a number is above or below a limit right now. The number comes from the state of an 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], or from one of its attributes. Use it when an automation should only continue if a value is in a certain range. For example, the automation only continues if the temperature in a room is above 24 °C, or if the battery of a device is below 20%.
The limit can be a fixed number, or the value of another entity. With the value of a number helper that you create yourself, you can change the limit later without editing the automation.
If the editor shows a condition named after what you want to check, use that one instead. For example, use Temperature value for temperatures, or Power value for power readings.
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 this condition 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.
- From the search box, search for and select Numeric state.
- In Entity, select the entity to check.
- Optional: In Attribute, select an attribute to check instead of the main state.
- Set at least one limit:
- For a lower limit, under Lower limit, select Fixed number or Value of an entity. Then, in Above, enter the number or select the entity.
- For an upper limit, do the same with Upper limit and Below.
- To check whether the value is in a range, set both limits.
- Optional: In Value template, enter a template that calculates the number from the state.
- Select Save.
Options in the UI
Whether Above is a Fixed number, or the Value of an entity. Default is Fixed number.
The value must be higher than this number. The number itself doesn’t pass. As Value of an entity, you can select a number helper, a number entity, or a sensor.
Whether Below is a Fixed number, or the Value of an entity. Default is Fixed number.
The value must be lower than this number. The number itself doesn’t pass. As Value of an entity, you can select a number helper, a number entity, or a sensor.
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, use condition: numeric_state. A basic example looks like this:
condition: numeric_state
entity_id: sensor.living_room_temperature
above: 17
below: 25
This passes when the living room temperature is above 17 and below 25.
Options in YAML
The options in YAML are the same as in the UI.
The ID of the entity, or a list of entity IDs, to check. With several entities, all of them must be within the limits.
The value must be higher than this number. Instead of a number, you can use the entity ID of an input_number, number, sensor, or zone entity. The condition then uses the current state of that entity. You must set above, below, or both.
The value must be lower than this number. Instead of a number, you can use the entity ID of an input_number, number, sensor, or zone entity. The condition then uses the current state of that entity. You must set above, below, or both.
A template that calculates the number to check. In the template, state is the state object of the entity.
The following example passes if both temperatures are below 18:
condition: numeric_state
entity_id:
- sensor.kitchen_temperature
- sensor.living_room_temperature
below: 18
The following example corrects the value of a sensor by 2 degrees before it checks the limits:
condition: numeric_state
entity_id: sensor.living_room_temperature
above: 17
below: 25
value_template: "{{ float(state.state) + 2 }}"
Targets of the condition
This condition checks one or more entities:
- Use the UI option Entity, or the YAML option
entity_id, to check one entity. - To check more than one entity, use a list of
entity_idvalues in YAML. All of them must be within the limits. In the UI, add one Numeric state condition per entity.
Good to know
- A value that is exactly the same as a limit doesn’t pass. For example, with Above set to
24, a value of24doesn’t pass. - If the value is unavailable (
unavailable) or unknown (unknown), the condition doesn’t pass. The same happens if an entity that you use as a limit is unavailable or unknown. - If an entity that you use as a limit doesn’t exist, the condition fails with an error. The error is shown in the trace.
- If the value isn’t a number, the condition fails with an error. For example, a state like
onoropenisn’t a number. The error is shown in the trace. - If you select an Attribute that the entity doesn’t have, the condition doesn’t pass.
- This condition checks the value right now. To start an automation when a value crosses a limit, use the Numeric state crossed threshold trigger.
- To check a state that isn’t a number, use the State condition.
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. In the visual editor, select the UI options listed in the example or paste the YAML code.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual 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: turn on the bedroom fan at night only when it’s warm
At 22:00, this automation turns on the bedroom fan, but only if the bedroom is warmer than 24 °C.
-
Trigger: Time
- At time: 22:00:00
-
Condition: Numeric state
-
Entity: Bedroom temperature (
sensor.bedroom_temperature) - Above: 24
-
Entity: Bedroom temperature (
-
Action: Turn on fan
-
Target: Bedroom fan (
fan.bedroom)
-
Target: Bedroom fan (
YAML example for turning on the bedroom fan when it’s warm
alias: "Bedroom fan on warm nights"
triggers:
- trigger: time
at: "22:00:00"
conditions:
- condition: numeric_state
entity_id: sensor.bedroom_temperature
above: 24
actions:
- action: fan.turn_on
target:
entity_id: fan.bedroom
Automation: water the garden only when the soil is dry
Every morning at 07:00, this automation turns on the garden irrigation, but only if the soil moisture is below a limit. The limit comes from a number helper that you create yourself, for example, Soil moisture limit (input_number.soil_moisture_limit). To change the limit later, change the value of the helper. You don’t need to edit the automation.
-
Trigger: Time
- At time: 07:00:00
-
Condition: Numeric state
-
Entity: Garden soil moisture (
sensor.garden_soil_moisture) - Upper limit: Value of an entity
-
Below: Soil moisture limit (
input_number.soil_moisture_limit)
-
Entity: Garden soil moisture (
-
Action: Turn on switch
-
Target: Garden irrigation (
switch.garden_irrigation)
-
Target: Garden irrigation (
YAML example for watering the garden when the soil is dry
alias: "Water the garden when the soil is dry"
triggers:
- trigger: time
at: "07:00:00"
conditions:
- condition: numeric_state
entity_id: sensor.garden_soil_moisture
below: input_number.soil_moisture_limit
actions:
- action: switch.turn_on
target:
entity_id: switch.garden_irrigation
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
Explore related conditions:
-
State: Tests if an entity, or one of its attributes, has a specific state.
-
Temperature value: Tests if a temperature value is above a threshold, below a threshold, or in a range of values.
-
Power value: Tests the power value of one or more entities.