Humidity in bathroom with various speeds fan

Hi,

I have a sensor in my bathroom for the humidity which is a tado head and it is named in my HA: sensor.sdd_parents_humidity.

I have 2 switches in order to control the air speed replacement in my home, it can be set to 1 or 3 and the 2 switches in HA are:
switch.vent_niveau_1 and switch.vent_niveau_3

I would like that when the humidity is going over 55% that the system is going to ventilation speed 3. It should go back to ventilation speed 1 only when humidity is back under 55% after 5 minutes but my problem is that it should go on speed 1 only if it went to speed 3 because the humidity was above 55%. What I mean is that sometimes the ventilation speed is already at speed 3 and if the humidity went above 55% then back, it shouldn’t go to speed 1 because it was already at speed 3…

Thanks if you can help me solve this problem…

If would have helped if you had included your code however I have attempted to outline what I think you need below:

Triggers:
  "Low Humidity" > numeric state sensor.sdd_parents_humidity < 55 for 5 minutes
  "High Humidity" > numeric_state sensor.sdd_parents_humidity > 55
Actions:
  Choose option 1 trigger_id = "Low Humidity"
     Condition switch.vent_niveau_3 = on
     Turn switch.vent_niveau_1 on
     Turn switch.vent_niveau_3 off
 Choose option 2 trigger-id = "High Humidity"
     Turn switch.vent_niveau_1 off
     Turn switch.vent_niveau_3 on

The key part to achieve what you need is the condition in choose option 1 which will only let the automation continue provided switch.vent_niveau_3 is already on.

I am not sure whether you will need to turn Turn switch.vent_niveau_1 on and off, it may be that you can keep this on all the time depending on the way that the fan operates.

Hope that is useful for you.