Ventilation automation humidity

i have this automation ruinning, to turn on the ventilation when jumidty reaches 83%:
taken from Humidity component

#badkamer ventilatie
- id: badkamer_ventilatie
  alias: 'Badkamer ventilatie'
  trigger:
    platform: numeric_state
    entity_id: sensor.badkamer_lywsd02_humidity
    above: 83
    for:
      minutes: 2
  condition:
  - condition: state
    entity_id: switch.afzuiging_badkamer
    state: 'off'
  action:
  - service: switch.turn_on
    entity_id: switch.afzuiging_badkamer

It turns on when the threshold is met, but doesnā€™t turn off again, when it is below the threshold again.
What is wrong?

You need to create an automation to turn it off again. You should be able to copy this one and just switch your trigger to use ā€œbelowā€ instead of ā€œaboveā€.

So where would you expect it to turn off?
As far as I read your automation it follows this story:

if the humidity >83 for 2 minutes and the afzuiging is off, turn on.

With my limited automation knowledge, you could clone this automation asking for being <83 for 2 min and then turning it off.

If you want to keep one Automation, you can experiment with having a sequence of actions:

  • turn_on
  • wait for 2 min
  • turn_off

you can then play with the new option ā€œmodeā€ for further comfort by automatically prolonging the fan on time by stacking the automations. There is goodexplanation on this in the 113:

1 Like

I donā€™t want to hijack this topic of course, but it is precisely the automation iā€™m trying to achive. However, iā€™m new to automations and struggle to get this working. I have basically copied this automation from the TS through the visual editor. It looks like this in the code editor:

alias: Badkamer ventilatie On
description: Schakelt ventilator aan als RH 2 minuten boven 70% is
trigger:
  - platform: numeric_state
    entity_id: sensor.alecto_ws1700_dc_02_humidity
    for:
      hours: 0
      minutes: 1
      seconds: 0
    above: 65
condition:
  - condition: state
    entity_id: switch.ac_000963b_10
    state: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 0
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.ac_000963b_10
mode: single

The fan is not starting, nor is it stopping (with the duplicated automation as mentioned here). When I operate this fan switch from my normal dashboard, it responds right away. Also, when I select to run the automation, the fan switches on right away. I canā€™t figure out why this is not working.

alias: Badkamer ventilatie On
description: Schakelt ventilator aan als RH 2 minuten boven 70% is
trigger:
  - platform: numeric_state
    entity_id: sensor.alecto_ws1700_dc_02_humidity
    for:
      hours: 0
      minutes: 1
      seconds: 0
    above: 65
    id: on
  - platform: numeric_state
    entity_id: sensor.alecto_ws1700_dc_02_humidity
    for:
      hours: 0
      minutes: 1
      seconds: 0
    below: 50
    id: off
condition: []
action:
  - service: "switch.turn_{{ trigger.id }}"
    data: {}
    target:
      entity_id: switch.ac_000963b_10
mode: single

Make sure the humidity is below 65 when you save the automation or it wonā€™t trigger

Hi Hellis81,

I see you have made some changes in the code. I assume this is what I should change it to for it to work? Just copy/paste it instead of what I have now (and disable those)?

I looks to me that you made a 2-in-1 action for it.

I just saved the code when humidty was below 65% and the I choose ā€˜run automationā€™ . However, nothing happened again. Looking through the log I found this:

Seems it doesnā€™t know that command?

Donā€™t use this button.
The automation will work fine if you just leave it as it is.

That button is not intended to be used on more advanced automations.