Temperature-based control with hysteresis to prevent rapid switching Three hysteresis modes depending on how you set the two thresholds Flexible temperature settings: Direct input or dynamic via input_number helpers Several fans at once: select as many switches or fan entities as you like Multi-window support: Optional monitoring of unlimited window sensors Safety features: Automatically turns off fan when sensor fails or any window opens Smart startup: Checks conditions when Home Assistant starts or automation is enabled
How it Works
The relationship between your two thresholds decides the behaviour:
Mode
When
Fan ON
Fan OFF
Normal
temp_on > temp_off
at or above temp_on
at or below temp_off
Equal
temp_on = temp_off
at or above temp_on
below temp_on
Inverted
temp_on < temp_off
rising and crossing either threshold
falling and crossing either threshold
With the defaults (ON at 30°C, OFF at 28°C) that is the normal case: the fan starts at 30°C and stops at 28°C.
Beyond that:
Fan turns OFF immediately if any window is opened
Fan evaluates conditions when windows close or Home Assistant restarts
Changing a helper does not switch the fan — only a temperature change does, and it then applies the new thresholds
No helper is needed for internal state; the automation uses trigger.from_state
Configuration
Required:
Temperature Sensor: Sensor measuring radiator temperature
Fan Switch: Switch, smart plug or fan entity. Select several and they are switched together
Optional:
Temperature ON (°C): Set direct value or use input_number helper
Temperature OFF (°C): Set direct value or use input_number helper
Window Sensors: Select any number of window/door contact sensors
Temperature Control - Two Options:
Option 1 - Direct Input (Simple):
Set fixed values: e.g., ON at 30°C, OFF at 28°C
Best for static setpoints
Option 2 - Input Number Helpers (Advanced):
Use input_number entities for dynamic control
Change temperatures on-the-fly via UI or other automations
Helper values override direct input if set
Example Use Cases
Single Room: Control a radiator fan to improve heat distribution
Multiple Rooms: Create separate automations for each room
Energy Saving: Stop heating when windows are open
Dynamic Control: Adjust temperatures based on time of day or other conditions
Early ON, late OFF: Set ON=28, OFF=32 for the inverted, path-dependent case
Installation
Method 1: One-Click Import
Click the import badge above!
Feedback Welcome!
Please let me know if you find any bugs or have suggestions for improvements!
Here is my scenario: Hot Air panel on roof, two vents contrlolled by Sonoff iFan04 flashed with Tasmota fw. I couldn’t control 2 fans simultaneously, so I edited yaml this way:
fan_switch:
name: Fan Switch
description: Switch or outlet controlling the radiator fan
selector:
entity:
filter:
- domain:
- switch
- fan
reorder: false
multiple: true
Now I can control them, but I don’t know how to set speed of fans. The iFan04 allows setting three fan speed levels - low, medium, and high.
Update: 1.2.0 is out, and it fixes a bug that mattered.
If you imported this blueprint before today, please re-import it.
1.1.4 — the fan could never switch on. Not at any temperature, in any of the three modes, if you had not selected any window sensors — which is the default. The variable that tracks whether a window is open returned the string 'false' instead of a boolean when there were no sensors to check, and a non-empty string is truthy in a template. Every switch-on path is guarded by that value. Switching off never looks at the windows, which is why the blueprint appeared to half-work rather than to be broken, and why nothing showed up in the log.
My apologies, that shipped in October and I did not spot it.
1.2.0 — several fans, and fan entities. You can now select as many devices as you like, and they no longer have to be in the switch domain.
Re-importing overwrites the blueprint and keeps your automations and their settings. Note the file moved into its own folder along the way, the badge above is current.
@Jarys , ten months late, sorry. You were right, and your edit is now in the blueprint.
1.2.0 supports what you patched in by hand: the Fan Switch field takes several entities, and accepts the fan domain alongside switch. No YAML editing needed.
Doing it properly turned out to need two more changes beyond the selector, which is worth mentioning in case anyone else patches it themselves:
switch.turn_on does not reach a fan entity, so switching now goes through homeassistant.turn_on / turn_off
the “is it already on?” checks needed match: any. Home Assistant otherwise requires every selected entity to match, so with one of your two vents running and the other idle, the condition was false and neither would have moved
That second one is the sort of thing that looks like it works until the two devices drift apart, so I would not have wanted you to run into it.
On fan speed: your own answer is the right approach, and I would keep it out of the blueprint. Speed control is device-specific (percentages, named presets and three-step controls all differ) so a separate automation calling fan.set_percentage after this one switches the fans is cleaner than trying to cover every device here. Thanks for posting the solution; it will help the next person with an iFan04.