Temperature changed
The Temperature changed trigger fires after a temperature reading changes. Temperature shifts gradually as heating or cooling systems cycle, rises when the sun heats a room in the afternoon, or drops overnight. Use the threshold type to filter which changes matter to your automation.
Use Temperature changed to log temperature trends, trigger heating or cooling when the temperature in a room changes noticeably, or alert you when a sensor reading shifts in a way that might signal a problem.
Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.
Using this trigger from the user interface
If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.
To use Temperature changed in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the When section, select Add trigger.
- Select what you want to monitor. Under By target (see Targets), pick the area your temperature sensor is in (like your bedroom or living room). You can also select a device, a specific entity, or a label.
- From the triggers shown for that target, select Temperature changed.
- Under Threshold type, configure what kind of change fires the trigger:
- Select Any change to fire on any change, regardless of direction or new value.
- Select Above or Below and enter a value to fire only when the new reading is above or below that value.
- Select In range and enter a lower and upper bound to fire only when the new reading falls inside the range.
- Select Outside range and enter a lower and upper bound to fire only when the new reading is outside the range.
- For each option, you can enter a fixed temperature, pick 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.
- Under Unit, select the temperature unit (°C or °F) to use for the threshold comparison.
- Select Save.
Options in the UI
Controls which changes fire the trigger:
- Any change: fires on any change, regardless of direction or new value.
- Above or Below: enter a value to fire only when the new reading is above or below that value.
- In range: enter a lower and upper bound to fire only when the new reading falls between them.
- Outside range: enter a lower and upper bound to fire only when the new reading is below the lower bound or above the upper bound.
For each mode you can enter a fixed temperature, reference a sensor entity or a number helper entity.
Using this trigger 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, Temperature changed is referred to as temperature.changed. A basic example looks like this:
trigger: temperature.changed
target:
entity_id: sensor.living_room_temperature
options:
threshold:
type: above
value:
number: 20
unit_of_measurement: "°C"
This fires whenever the living room temperature sensor reading moves to a value above 20°C. To fire on any change regardless of direction or value, use type: any and omit value.
To fire only when the new reading is within a comfort range:
trigger: temperature.changed
target:
entity_id: sensor.living_room_temperature
options:
threshold:
type: between
value_min:
number: 20
unit_of_measurement: "°C"
value_max:
number: 22
unit_of_measurement: "°C"
To fire only when the new reading is outside a comfort range:
trigger: temperature.changed
target:
entity_id: sensor.living_room_temperature
options:
threshold:
type: outside
value_min:
number: 20
unit_of_measurement: "°C"
value_max:
number: 22
unit_of_measurement: "°C"
Options in YAML
YAML sometimes provides additional options for more complex use cases that are not available through the UI.
A mapping that defines which kind of change fires the trigger:
-
type: any: Fires on any change (no additional keys needed). -
type: aboveortype: below: Providevaluewith anumberkey (for a literal number) or anentitykey (for aninput_number,number, orsensorentity). -
type: betweenortype: outside: Providevalue_minandvalue_max, each with anumberkey (for a literal number) or anentitykey (for aninput_number,number, orsensorentity).
When using the number key, you must also include unit_of_measurement to specify the temperature unit (°C or °F). When using the entity key, the unit is taken from the entity itself.
For example:
threshold:
type: outside
value_min:
entity: input_number.comfort_temperature_min
value_max:
number: 24
unit_of_measurement: °C
A sensor entity’s current reading is used as the threshold, which lets you compare two temperature readings dynamically.
Targets of the trigger
This trigger requires a target. The target is the object that Home Assistant will watch. You can select 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 as a target, and Home Assistant will watch every matching temperature entity behind that target.
-
Entity: one specific temperature entity, such as
temperature.living_room. - Device: every temperature entity that belongs to a device.
- Area: every temperature entity in a room or area.
- Floor: every temperature entity on a floor.
- Label: every temperature entity that shares a label.
You can also select different target types in one trigger. For example, you can add a specific entity and an area as targets in the same trigger to monitor both of them at once.
Good to know
- The threshold type controls both the direction and the landing zone of the change. Use Above or Below to filter by direction, In range to fire only when the new value is inside a range, and Outside range to fire only when it escapes a range.
- Use Any change to fire on every change regardless of direction or where the new value lands.
- To react only when temperature first crosses a specific level, use Temperature crossed threshold instead.
- The trigger works with climate entities, water heater entities, weather entities, and sensors with the temperature device class.
- Climate, water heater, and weather entities that don’t report a current temperature attribute are automatically excluded from the trigger. Only entities with a valid temperature value can fire the trigger.
- All temperature values are automatically converted to the unit you specify. For example, if your sensor reports in Fahrenheit but you configure the trigger in Celsius, the conversion happens automatically.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, then change the state of the targeted entity to watch the trigger fire on your actual entitiesAn 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].
More examples
Real scenarios where this trigger fires in automations and scripts. 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: turn on heating or cooling when temperature leaves comfort range
When the living room temperature changes to a value outside the comfort range (20 to 22°C), this automation turns on heating or cooling to restore comfortable conditions.
- Trigger: Temperature changed
- Target: Living room temperature sensor
- Threshold type: Outside range (20-22°C)
- Action: Set thermostat HVAC mode (state: cool)
YAML example for climate control when outside comfort range
alias: "Adjust climate when living room is uncomfortable"
triggers:
- trigger: temperature.changed
target:
entity_id: sensor.living_room_temperature
options:
threshold:
type: outside
value_min:
number: 20
unit_of_measurement: "°C"
value_max:
number: 22
unit_of_measurement: "°C"
actions:
- if:
- condition: template
value_template: "{{ trigger.to_state.state | float < 20 }}"
then:
- action: climate.set_hvac_mode
target:
entity_id: climate.living_room
data:
hvac_mode: heat
else:
- action: climate.set_hvac_mode
target:
entity_id: climate.living_room
data:
hvac_mode: cool
Automation: alert when temperature leaves comfort range
This automation sends a notification when any room temperature drifts outside the comfort range of 20 to 22°C, helping you maintain consistent conditions throughout your home.
- Trigger: Temperature changed
- Target: All temperature sensors (label)
- Threshold type: Outside range (20-22°C)
- Action: Send a notification
YAML example for comfort range alert
alias: "Alert when temperature leaves comfort range"
triggers:
- trigger: temperature.changed
target:
label_id: temperature_sensors
options:
threshold:
type: outside
value_min:
number: 20
unit_of_measurement: "°C"
value_max:
number: 22
unit_of_measurement: "°C"
actions:
- action: notify.mobile_app
data:
message: >
Temperature in {{ trigger.to_state.name }} is {{
trigger.to_state.state }}°C
Automation: alert when temperature enters comfort range
Send a notification whenever the bedroom temperature changes to a level within your personal comfort range. Use number helpers for the range bounds so you can easily adjust your preferred temperatures through the UI.
- Trigger: Temperature changed
- Target: Bedroom temperature sensor
- Threshold type: In range (entity: comfort temperature min and max)
- Action: Send a notification
YAML example for using number helpers as threshold
alias: "Alert when temperature enters comfort range"
triggers:
- trigger: temperature.changed
target:
entity_id: sensor.bedroom_temperature
options:
threshold:
type: between
value_min:
entity: input_number.comfort_temperature_min
value_max:
entity: input_number.comfort_temperature_max
actions:
- action: notify.mobile_app
data:
message: "Bedroom temperature is now {{ trigger.to_state.state }}°C, within your comfort range."
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger 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 triggers or suggest the right one when you describe what you want in plain language.
Related triggers
These triggers work well alongside this one:
- Temperature crossed threshold: Triggers after one or more temperature readings cross a threshold.