Setup:
I have a snake enclosure with three humidity sensors being averaged together with a helper. I have a Noctua NF-P12 PWM fan mounted on one of the vents. Then fan PWM pin is connected to an ESP32 (powered separately with 12V) giving me full 0-100% speed control.
Goal:
I’m wanting to set a target humidity (75%) and have the fan ramp up/down to maintain it.
I’m struggling with figuring out how to get started. A search on here/Google consistently gets me to either controlling humidity by just toggling a switch on/off or managing standard high/medium/low speed fans (e.g., bathroom humidity fan blueprint).
You need to figure out the logic. Where does the humidity come from? If it’s just the general environment running a fan will do nothing to lower it. Exhaust fans are usually meant to clear additional humidity created by a shower.
If it’s from the evap of water in the enclosure from the heat lamps you could try a derivative sensor. Depending on how fast the humidity rises, raise/lower fan speed.
alias: Blaidd's Humidity Fan
description: ""
trigger:
- platform: state
entity_id:
- sensor.blaidd_s_tank_cool_side_wet_avg
condition: []
action:
- action: fan.set_percentage
metadata: {}
data:
percentage: >-
{% set target_humidity = 75 %}
{% set max_fan_speed = 100 %}
{% set min_fan_speed = 0 %}
{% set current_humidity = states('sensor.blaidd_s_tank_cool_side_wet_avg') | float %}
{% set humidity_difference = current_humidity - target_humidity %}
{% if humidity_difference >= 1 %}
{% set new_fan_speed = 30 + ((humidity_difference - 1) * 20) %}
{% else %}
{% set new_fan_speed = min_fan_speed %}
{% endif %}
{% set new_fan_speed = [min_fan_speed, [new_fan_speed, max_fan_speed] | min] | max %}
{{ new_fan_speed | int }}
target:
entity_id: fan.blaidds_enclosure_light_and_fan_fan_speed
mode: single
Target humidity is 75%. At 1% over, fan goes to 30% (needed to be mildly aggressive or the fan just runs constantly). At 2%, bump to 40%. For every 1% over in humidity after, the fan speed increased by 20 until 100% speed.