Reduce humidity in basement - automation does not work

Hi,

I am trying to do an automation to reduce humidity in our basement. There is a little fan installed, including a D1 mini, Sensors and a relay. The fan can be manually triggered via HA.

My plan: I added openweathermap to my HA. I can compare dew point data from insight and outside. This works fine.
2021-08-10 12_44_47-Klima - Home Assistant
As you can see, the dewpoint within our basement is almost allways above the outside value. So I wanted to add a trend-calculation: whenever the dewpoint in our garden is rising, the fan in basement should stop. The trend calculation for the garden-dew point works as well.


To be on the save side, I added the trend calculation to the basement value as well.

My automation does start the fan, but I never observed it to stop the fan. During the last week, I tried a lot of things and the current automation should work - but it doesn’t. Any help is very much appreciated!

alias: Garage LĂĽfter Steuerung "on"
description: Startet den LĂĽfter, wenn der Taupunkt draussen tiefer ist, als in der Garage
trigger:
  - platform: time_pattern
    id: time_intervall
    minutes: /5
condition:
  - condition: numeric_state
    entity_id: sensor.tasmota_am2301_dewpoint
    above: sensor.openweathermap_dew_point
  - condition: and
    conditions:
      - condition: state
        entity_id: binary_sensor.openweathermap_dewpoint_trend_rising
        state: 'off'
        for: '00:15:00'
      - condition: state
        entity_id: binary_sensor.tasmota_am2301_dewpoint_trend_rising
        state: 'off'
        for: '00:15:00'
action:
  - service: switch.turn_on
    target:
      entity_id: switch.tasmota
  - wait_template: '00:05:00'
  - service: switch.turn_off
    target:
      entity_id: switch.tasmota
mode: single


EDIT: I don’t know, if this is relevant: I created my first version of the automation on my laptop, as we are on holiday now, I tried to change it on my mobile phone in the HA-app. The app is great, but is there perhaps an issue, when doing changes to automations within the app?

time pattern: well, the humidity insight will always be above the outside value. (Its an old house, humidity comes through the walls/from the ground.) As the dew point insight will never fall to a level lower than outside, and I want to fan not to run 24/7, I only found the time pattern to use. Is there a better way?

For the wait template, you just want to add a delay right?
You should use Delay function.

Wait Template is used to evaluates a template, and if true, the action will continue. If not, then it will wait until it is true.

2 Likes

what if you create a difference sensor between the inside dewpoint and outside dewpoint. When this delta is above a predefined threshold start the fan, when it falls below the threshold stop the fan. I do this with the temperature on my 3 story house. if the delta between any two floors is above a threshold I start my furnace fan to circulate / balance the temperature until the delta drops below a certain value. Not exactly the same situation but similar. If you need templates let me know.

After changing to the delay-function, my automation does, what it is designed to do. Thank you very much for your help and inputs.

Regarding difference-sensor: this seems to be a good idea, if to sensors are not in sync? (Which seems to be the case in my installation. I believe, I could correct the sensor values in Tasmota directly…) I will keep this solution in mind.

I will test my automation for a couple of days and see, if it does, what I want it to do. :slight_smile:

Hi,
here is a short update to my automation. There is one issue, which I do not understand completely.

My automation should start the fan, if:

  • dew point in cellar is above dew point outside (-> garden)
  • AND dew point in the garden did not rise within the last 15min

but what I see is, that if the conditions are true, the fan is switched on for 5min, then turned off for 5min, then turned on for 5min, etc.

Is there something wrong with my trend-calculation or with the state-condition and the “for”-functionality?

2021-08-16 20_41_50-Klima - Home Assistant
[1] trend value in a binary sensor: if rising more than 0.25°C per hour, then “Problem”, otherwise “ok”
[2] switch, which turns on the fan (-> D1 mini with relay and sensor)

Code binary sensor:

  - platform: trend
    sensors:
      openweathermap_dewpoint_trend_rising:
        entity_id: sensor.openweathermap_dew_point
        friendly_name: "Garten Taupunkt steigend"
        sample_duration: 3600
        max_samples: 20
        min_gradient: 0.00007   # der min_gradient ist die Steigung der Kurve, welche sich aus Temperatur/Zeiteinheit berechnet. Hier: 0.25 °C/3600 Sekunden = 0.00007
        device_class: problem

Code automation:

alias: Vorratskeller LĂĽfter Steuerung "on"
description: Startet den LĂĽfter, wenn der Taupunkt draussen tiefer ist, als drinnen
trigger:
  - platform: time_pattern
    id: time_intervall
    minutes: /5
condition:
  - condition: numeric_state
    entity_id: sensor.tasmota_am2301_dewpoint
    above: sensor.openweathermap_dew_point
  - condition: state
    entity_id: binary_sensor.openweathermap_dewpoint_trend_rising
    state: 'off'
    for: '00:15:00'
action:
  - service: switch.turn_on
    target:
      entity_id: switch.tasmota
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    target:
      entity_id: switch.tasmota
mode: single

I think the conditions are OR, not AND. So if at least one of them is true, your automation starts.

Is your fan facing inward?

I have to correct myself, conditions are ANDed, according to docs.

@schneich slightly off-topic, but I am also thinking about adding a fan in the basement to fight humidity. Also located in Germany. Can you tell me what fan you are using? What’s your experience (independent from the automation trouble), does it help much? Are you blowing air out or sucking air in?

Well, there are other german speakting nations… :wink:

fan: PROFAN Technology P21755HBL-ES AxiallĂĽfter 230 V/AC 382 mÂł/h (L x B x H) 172 x 151 x 55 mm

switch: D1mini & relay runing on Tasmota, AM2301

Experiences: as this is still in beta-state, not much to say - yet. I bought the fan, because we do have a Radon-Issue in our basement. Thats why I am blowing the air out. At least one window has to be open, so that fresh air can come in. There is an effect, as you can see in the charts above. the fan pushes 380m3 of air per hour, depending on the size of the basement, it has to run a substantial amount of time to have a substantial effect. The last couple of days were not ideal to test, because of the high humidity outside - even at night. As soon as the automation runs smoothly, I hope to have a better effect.

I see. Thank you very much for the details. Having to open a window seems to defeat the fan automation though?

To reduce the humidity, you can either use an air dehumidifier or you can make sure that you supply air into the room, which contains less water, than already there. The air must come from somewhere, so having a tilted window is a cheap option. Or you install a heat exchanger/air heat pump, which reduce the humidity as well.

How about separate automations for fan start and fan stop, with the difference sensor. If you want to get into esphome you can use 2 AM2301s and a relay and run the logic on the ESP, and send the humidity values and fan relay staus into HA for monitoring. It becomes self sufficient of any HA issues…

BillyBobK
How about separate automations for fan start and fan stop, with the difference sensor. If you want to get into esphome you can use 2 AM2301s and a relay and run the logic on the ESP, and send the humidity values and fan relay staus into HA for monitoring. It becomes self sufficient of any HA issues…

Thank you very much for the input. My first plan was, to do something as you proposed. with our old house, it is a bit difficult, to get one sensor outside and one sensor inside and still both connected to one Arduino Nano/D1 mini. There is no good spot to put the sensor outside and still get proper readings. thats why I have put my horse on HA. And it is more complex and more fun. :slight_smile:

the solution I have choosen above, is working. But there is one downside. as it is triggered every 5min, the fan is stopping for a short moment and then resumes again. I want to get rid of this stop and go and there seems no way to do this, when using a time based trigger. thats why I am trying a different approach.

I have built something similar (documentation is WIP though, … home-assistant/README-basement.md at 3aef40ca950e21cc15b836bf4ca4d4f73df6d1af · swa72/home-assistant · GitHub)

1 Like

What about something were you create some hysteresis in your on off triggers with two completely separate triggers
eg.

  1. When humidity is rising for x:minutes start fan.
  2. When humidity is falling for x: minutes stop fan.

This will start the fan when the humidity is rising and ONLY stop the fan when it is falling (not time based).

I like the idea of having triggers other than time based. On the other hand, they may be too complicated for a first run. I’m still testing my setup with simple durations and later, with more experience, upgrade to something more sophisticated like you suggested :wink:

I have implemented a similar automation based on a simple state machine for drying my cellar. It has three states:

  1. cross-ventilation driven by a window fan, if the cellar humidity exceeds 50% - but only if the absolute humidity outside is lower than inside

  2. power consuming air drying with an electric dehumidifier, but only if ventilation (1) is not possible but the cellar humidity raises above critical level (>60%)

  3. do nothing as long as everything is within acceptable limits…

What I like about my automation: The transitions between the states are triggered only if sensor values change or exceed the limits.

I would like to share this if anyone else is currently interested in the topic?

I would be interested, if this is still up-to-date.
I have an own automation based on dew point delta between indoor and outdoor. However, it runs arbitrary and doesn’t stop, even if the dewpoint isn’t close to the my chosen 5° delta. I believe, the automation is buggy and I also have to admit that I don’t understand it fully:

alias: de-Humidifier between 5 and 3 Taupunkt Delta
trigger:
  - platform: numeric_state
    entity_id: sensor.filtered_taupunkt_delta
    above: 5
    for:
      hours: 0
      minutes: 5
      seconds: 0
  - platform: numeric_state
    entity_id: sensor.filtered_taupunkt_delta
    below: 3
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition: []
action:
  - service: >-
      input_boolean.turn_{{ 'off' if states('sensor.filtered_taupunkt_delta') |
      float < 3.0 else 'on' }}
    entity_id: input_boolean.beluftung_keller
  - service: >-
      input_boolean.turn_{{ 'on' if states('sensor.filtered_taupunkt_delta') |
      float < 5.0 else 'off' }}
    entity_id: input_boolean.beluftung_keller
mode: single

this is the dew point plot from last night an the automation triggered to on at:

“Triggered by the numeric state of sensor.filtered_taupunkt_delta at 18. September 2023 um 03:07:04”

Does anybody has an idea what might be wrong here?