Automation does not run

This is driving me insane!
The idea is to turn on a fan if the humidity is too high. (I am using the “choose” action, as there will eventually be more triggers added.)
The switch works when toggled manually and the humidity sensor shows the correct value.
But for some reason, the automation does not turn on the fan.
What could be wrong?

id: '1651904268154'
alias: Bathroom:Fan_control
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.humidity
    id: too_humid
    above: '70.0'
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: too_humid
        sequence:
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.shelly_plug_s_relay_0
    default: []
mode: single

The automation only triggers when the humidity goes from below 70 to above 70.

Remove the quotes on ‘70.0’ ?

That makes no difference.

What’s your testing procedure? In other words, how are you varying the sensor’s value and over what range of values?

I assume you know that manually triggering an automation will skip its trigger and simply execute its action.

I’m still new to HA, but one of the things that tripped me up when doing something similar for a fan triggered by temperature is that the item in question (for you, humidity) has to start below 70% and then get above 70% for the numeric state to trigger. If you created the automation when it was above 70% and it’s not gotten below 70% humidity yet, that trigger won’t be fired.

Assuming that’s the problem, you could change the trigger to fire at every humidity change and then have a condition that checks to see if the humidity is about 70%, but that means the automation will trigger much more frequently just to check that condition. And that might not be what you want anyway.

Another workaround I use is to have a time trigger (in my case, sunrise). I use a choose kind of like yours for the trigger name and then add a condition to check the temperature. This basically makes sure the automation starts the fans in the morning if it’s already warmer than I want it to be.

you need to remove numeric state from the trigger and change to state. then remove the numbers. in choose set the condition to state to above 70. for on and another choose with condition to below 70 for off.

Thank you all for your suggestions.
I managed to get it working by triggering on state and then a condition for the numerical value. So that could be a viable solution.
But it would make much more sense to have it trigger when the humidity crosses the threshold.

I will eventually add another trigger that will turn off when passing a lower threshold, and also always run for an hour or so every day (which is enough to drive the humidity to below the threshold).

But I am very new to HA, so I thought this would be a good first step.
(And yes, in my tests the value is below the threshold and then being raised. But thanks for pointing it out. I have done that mistake before in another use case.)

That’s exactly what it does. Trigger when the threshold is crossed.

However if your sensor state is already above 70 when you reload automations or restart, it won’t trigger as it is already above the threshold.

Except it doesn’t.

But I can only assume that the error is elsewhere, since all replies suggest that there is nothing wrong with my automation config as such.

What says in the automation debugger

I couldn’t find anything wrong with your code, however, before you invest more time on this one, I would suggest you to take a look at the Generic Hygrostat integration as I believe it does exactly what you are trying to do.