Home Assistant

Fan speed that follows room temperature

A room temperature sensor scales a fan from a minimum to a maximum speed, snaps a ceiling fan to low, medium, and high, or switches a plug on and off, with hysteresis and a manual hold.

Difficulty · BeginnerSetup · 20–40 minutesHA · 2024.10 or newer
Get the pack · from $19Have us set it up

Some hardware links on this page are affiliate links. As an Amazon Associate I earn from qualifying purchases. We may earn a commission if you buy through them, at no extra cost to you. See the affiliate disclosure.

A fan that is only on or only off is either too much or not enough once the room is close to comfortable. This blueprint reads a temperature sensor and drives one fan entity, or one switch. Percentage mode scales the speed between two temperatures. Three-speed mode snaps to low, medium, and high. On/off mode is for a smart plug. Hysteresis keeps it from ticking up and down every minute. If someone changes the fan by hand, the blueprint leaves it alone for a while.

One button that walks the same speeds by hand, instead of from a temperature, is fan speed cycle button. A plug on a space heater, with occupancy and a watt check, is space heater plug manager. Humidity rather than temperature is humidity climate control.

What problem it solves

You want a ceiling fan or a plug-in fan to track the room, including a pause when someone turns it down on purpose.

How it works

  1. Percentage. At the minimum temperature the fan is at the minimum speed. At the maximum temperature it is at the maximum speed. Between them the speed is linear. At or below minimum minus the hysteresis, the fan turns off. A new speed within the speed step (default 5 points) of the current speed is ignored.
  2. Three speeds. Off at or below the first temperature, low until the second, medium until the third, high above that. The speeds are percentages (default 33, 66, and 100). The hysteresis has to be crossed before the step changes, so a reading that wobbles on the line does not alternate.
  3. On/off. The load turns on at the maximum temperature and off at that temperature minus the hysteresis. Use this for a switch or a smart plug. Percentage and three-speed modes call fan services, so they need a fan entity.
  4. Occupancy. Off by default. Turn it on and name a presence sensor. The allowed states are a comma-separated list (on for a binary sensor, home for a person). Anything else forces the load off. The pack includes a stand-in boolean that stays off, so leaving the condition on without changing the entity keeps the fan off.
  5. Time window. Off by default. Turn it on and set a start and an end. Outside the window the load is forced off. A start later than the end wraps past midnight.
  6. Manual hold. If the load changes by hand (a dashboard user, or a change that did not come from this automation), the blueprint writes “now plus N minutes” into a datetime helper and does not touch the load again until that time. The default hold is 30 minutes. The minute tick still runs, and it resumes on its own when the clock passes.

The automation is queued, so a burst of sensor updates does not cancel a hold that is being written.

Snippet

The three triggers that matter. The manual path is the load changing. Temperature and the minute tick are the control path.

triggers:
  - trigger: state
    entity_id: !input temperature
    id: temp
  - trigger: time_pattern
    minutes: "/1"
    id: tick
  - trigger: state
    entity_id: !input load
    id: manual

A hand change is one whose context has a user, or no parent automation. This automation’s own speed commands are ignored, so it does not pause itself.

Setup outline

  1. Copy helpers/temperature_fan_control.yaml into config/packages/ (packages have to be enabled) and restart, or create the same datetime and boolean helpers yourself. Copy blueprints/automation/temperature_fan_control.yaml into config/blueprints/automation/edotdev/ and reload blueprints.
  2. Create the automation. Pick the temperature sensor and the fan, or the plug.
  3. Pick the mode. For a ceiling fan that only likes three speeds, use three-speed and set 33, 66, and 100, or whatever percentages that fan actually accepts. For a plug, use on/off.
  4. Set the temperatures as plain numbers in the same unit the sensor reports. The blueprint compares the raw state. It does not convert °C to °F.
  5. Leave occupancy and the time window off until the speed tracking looks right. Then turn on the one you want.
  6. Change the fan from the dashboard. It should stay where you put it until the hold expires. After that, the next minute tick should set the speed from the temperature again.

Troubleshooting

  • It turns the plug off immediately. Mode is still percentage or three-speed, and the target is a switch. Those modes call fan.set_percentage. Switch the mode to on/off.
  • It never turns on. Occupancy is enabled and the stand-in boolean is off, or the time window is enabled and the clock is outside it. Either condition forces the load off.
  • It fights the wall control. The fan’s remote does not show up as a state change with a user attached, and the integration reports the new speed as if an automation did it. Widen nothing: shorten the hold and change the speed again. If the context has no user and has a parent, this blueprint treats it as its own command. Watch the trace on the manual trigger.
  • The speed chatters. Hysteresis is 0, or the speed step is 1 on a noisy sensor. Raise the hysteresis to a few tenths of a degree, and the speed step to 5 or 10.
  • Three-speed jumps from off to high. The three temperatures are not in order, or medium and high percentages are swapped. Low temperature should be the smallest number.
  • A second room shares the hold. Both automations use input_datetime.fan_override_until. Duplicate the helper and pick the new one on the second automation.
  • °F sensor, °C thresholds. The blueprint does not convert. Type the thresholds in the unit the sensor reports.

Credits

Temperature-driven fan speeds, including a ceiling fan’s low, medium, and high, are the subject of Temperature control fan + ceiling fan mode.

Changelog

v1.0 · Nov 2, 2026: First publish.