We have Home Assistant running in our RV with a plethora (about 14) of temperature and temperature / humidity sensors. One of the worst things in an RV is water damage, and condensation on the windows / walls due to high relative humidity can be a major cause.
Condensation is worst on the window frames which are essentially a thermal bridge straight to the outside. As the temperature drops outside, the temperature of the window frames approaches the dew point given the humidity inside, and hence causing condensation.
We have a 35 pint dehumidifier which can easily keep the humidity low, but is noisy and draws a lot of power. Further, setting the humidity too low makes the air feel too dry and isn’t very pleasant.
The solution? Dynamically calculate the relative humidity that would cause the window frames to reach the dew point and control our dehumidifier to ensure the relative humidity inside stays at or slightly below this level.
Using the August-Roche-Magnus calculation from here, I implemented a few sensors and automations in Home Assistant to achieve this. It looks like there’s a Generic Hygrostat component coming soon in Home Assistant, so when that lands I’ll be able to simplify my approach somewhat.
I’ve also added basic hysteresis to prevent the dehumidifier toggling on / off too fast since my sensors each update about every 60 seconds, so the relative humidity target is recalculated about twice per minute.
Thought I’d share in case anyone else finds this useful. It wouldn’t be too hard to extend this with other overrides, such as minimum and maximum thresholds.
Here’s the package I use to achieve this.
dehumidifier:
sensor:
# based on this formula: https://bmcnoldy.rsmas.miami.edu/Humidity.html
# RH: = 100 * ( EXP( (17.625*TD)/(243.04+TD) ) / EXP( (17.625*T)/(243.04+T) ) )
- platform: template
sensors:
max_humidity_allowed:
friendly_name: Max Humidity Allowed
device_class: humidity
unit_of_measurement: '%'
icon_template: mdi:water-percent
value_template: >-
{{ (100.0 * ( e ** ((17.625*(states('sensor.outside_temperature')|float))/(243.04+(states('sensor.outside_temperature')|float))) ) / ( e ** ((17.625*(states('sensor.inside_temperature')|float))/(243.04+(states('sensor.inside_temperature')|float))) )) | round(0) }}
binary_sensor:
- platform: template
sensors:
should_run_dehumidifier:
friendly_name: "Should Run Dehumidifier"
value_template: >-
{{
(states('sensor.inside_humidity') | float) >
(states('sensor.max_humidity_allowed') | float)
+ (1.0 if is_state('binary_sensor.should_run_dehumidifier', false) else 0)
- (4.0 if is_state('binary_sensor.should_run_dehumidifier', true) else 0)
}}
automation:
- alias: Turn the dehumidifier on or off
trigger:
- platform: state
entity_id: binary_sensor.should_run_dehumidifier
- platform: state
entity_id: binary_sensor.dehumidifier_status
- platform: homeassistant
event: start
condition:
condition: state
entity_id: binary_sensor.dehumidifier_status
state: "on"
action:
- service_template: >
{% if is_state('binary_sensor.should_run_dehumidifier' , 'on') %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
data:
entity_id: switch.dehumidifier
The above assumes that your temperatures are in °C. If you are using °F then the following (even more unwieldy) formula is needed:
{{ (100.0 * ( e ** ((17.625*(((states('sensor.outside_temperature')|float)-32)/9*5))/(243.04+(((states('sensor.outside_temperature')|float)-32)/9*5))) ) / ( e ** ((17.625*(((states('sensor.inside_temperature')|float)-32)/9*5))/(243.04+(((states('sensor.inside_temperature')|float)-32)/9*5))) )) | round(0) }}