Smart Humidity Climate Control (Multi-Device with Manual Override)

Smart Humidity Climate Control (Multi-Device with Manual Override)

Import Blueprint

GitHub: GitHub - eleniontolto/Absolute-Humidity-Control---Multi-device-with-Manual-Override: Humidity-based climate automation using Magnus-Tetens thermodynamic normalization. Features manual override detection, configurable safety watchdog, independent rest and cooldown timers, multi-device support, and graceful sensor fallbacks. Supports fans, switches, lights, and input booleans.


What It Does

Humidity control for Home Assistant that handles the real world. At its core it turns devices on when humidity rises and off when it drops — but it goes further:

  • Uses temperature-corrected humidity math (Magnus-Tetens) to eliminate false triggers from room-to-room temperature differences — configured in familiar percentage (%) rather than absolute water mass units
  • Detects manual overrides and respects them — backs off when you touch a device and waits a configurable window before taking back control, no tug-of-war
  • Protects equipment with a configurable safety watchdog that force-stops devices if they run too long, followed by a dedicated rest period to let equipment recover
  • Separate turn-on and turn-off thresholds prevent rapid on/off cycling when humidity hovers near a trigger point
  • Controls multiple devices as a unified group with shared lockout logic — touch any one device and the whole group suspends automation cleanly until the manual override timer expires
  • Gracefully handles sensor failures with configurable fallback modes

No more automation fighting you for control of your own devices. No more fans running all day because a sensor went offline. Put it all together and you get humidity control that works quietly in the background, responds intelligently when you need to intervene, and protects your equipment along the way — without you ever having to think about it again.


Features

  • Thermodynamic Normalization — Magnus-Tetens formula corrects reference humidity to the primary room’s temperature, eliminating false triggers from room-to-room temperature differences
  • Manual Override Detection — Detects who changed a device via HA’s context system; any manual touch pauses the entire group for a configurable cooldown — no tug-of-war
  • Two Independent Timers — Safety Rest Period and Manual Override Cooldown are fully separate; tune each for your specific needs
  • Safety Max Run Watchdog — Force-stops devices after a configurable maximum run time to protect equipment from sensor failures or open windows
  • Two-Track Max Run Timer — Automation-activated and manually-activated devices use separate max run calculations so the watchdog always fires at the right time
  • Smart Safety Rest Loop — Handles manual touches during a rest period gracefully, keeping both timers honest
  • Multi-Device Support — Fans, switches, lights, input booleans, or helper groups; all act as a unified team with shared lockout logic
  • Per-Device Recovery — After any lockout expires, each device is individually reclaimed so a manually-toggled device is correctly recovered even if others were unaffected
  • Direction-Aware Hysteresis — Separate rising and falling thresholds prevent rapid cycling
  • Dynamic Fail-Safe — Falls back to a Static Baseline slider or Raw RH% comparison if reference sensors go offline
  • Automatic Unit Conversion — Handles mixed °C/°F sensor hardware transparently

Requirements

  • Primary humidity sensor
  • Control Device (fan, dehumidifier, etc)
  • Primary temperature sensor, reference humidity sensor, reference temperature sensor (all optional, but needed for full thermodynamic normalization)

Known Limitations

  • Effective run time: Due to HA’s minute-tick polling, devices run for approximately max_run + 1 minutes per cycle. Set values accordingly.
  • Sensor response lag: Temperature and reference humidity sensor changes may take up to 60 seconds to affect behavior. Primary humidity sensor changes are always instant.
  • Sensor accuracy: Consumer humidity sensors carry ±2–3% tolerance. Two sensors measuring the same air can read 4–6% apart. Avoid thresholds tighter than your sensors’ combined accuracy.
  • Manual override detection: Relies on HA’s context system. Some voice assistants and third-party integrations may not correctly identify manual changes, bypassing the lockout.
  • HA restart during Safety Rest: The rest timer is lost on restart. Devices may re-activate before the full rest period has elapsed.
  • Device flicker: Devices may briefly turn off then immediately back on during transitions out of manual override periods. This is intentional — the automation clears stale user contexts before reclaiming devices to ensure timer logic stays accurate.
  • Helper Group tip: If using a Helper Group, “All Entities” OFF mode is recommended — “All Entities” ON can cause partial manual-ON states to go undetected by the lockout.

Credits

Based on [Switch a fan based on absolute humidity difference between two humid/temp sensors] by W6Es3QEa. Substantially rewritten with multi-device support, manual override intelligence, safety watchdog, independent timer architecture, per-device drift detection and modern Home Assistant standards.

1 Like

Installed yesterday. Great design. However, I cannot get the manual lockout to work correctly. Lockout works if I turn a switch on in the App, but it does not recognize a manual activation from the physical switch itself. Tried matter and TP link integrations for switches. Neither function as intended. Probably something I am doing incorrectly.

Thanks for reporting back! I’ll take a look. I didn’t thoroughly retest that particular function with physical switching after some later changes as much as I should have, was mostly using voice assistants like alexa. What type of switches or smart devices do you have?

Edit: whoops, i see you said tp-link. Are these standard smart wall switches? Are they actual tp-link brand or are they kasa/tapo?

I haven’t been able to reproduce your issue with any of my devices (though did discover some edge cases I need to account for that can cause strange behavior so am working on that). When it was failing, what was it doing exactly? Just turning your device back on/off at the next sensor update or poll, within a minute or two, instead of waiting for the manual override to expire? I’ve got a debug mode mostly added in so if need be you can try that out and share the logs after I commit the changes. However, I think I know what is probably causing your issue even though none of my devices have this issue. I will try to get some code updates incorporated for you to test out.

Ok, amazing. Sorry, yes they are Kasa Switches which turn the bathroom fans on and off (Matter and non-matter). My test case was to manually activate the switch (physically) and see if the manual lockout would activate. I have tried using the TP-link integration and the matter integration. In both cases, the manual lockout does not activate and the automation turned the fans off within 30 seconds or so. The manual lockout will activate if use the companion app to turn on a switch manually.

For now I’ve just created helper automations using Boolean and timers. It works great that way.