Variables in fan automation

I’ve been working on an automation to turn off a fan when the humidity falls below a certain level, and this is now working fine.

However, the automation uses a hardcoded value in the 'below: ’ field. What I’d like to do is have this configurable, and an input number helper seemed ideal. I can set (and change) the number to anything I want.

However, I’m not sure whats wrong when I try to use it.
This is an extract from my automation:-

condition:
  - type: is_humidity
    condition: device
    device_id: 457ad6a2ee920963e324bab25c4242db
    entity_id: sensor.lumi_lumi_weather_humidity_3
    domain: sensor
    below: {{ states('input_number.ensuite_humidity_threshold') | float }}

But I cannot save this as I get this error on screen:-

Message malformed: expected float for dictionary value @ data[‘below’]

If I use the dev tools, it seems to evaluate correctly:-

I’m sure its something simple, but I can’t seem to figure it out.

You’re using a Device Condition and it doesn’t support templates.

Try this:

condition:
  - condition: numeric_state
    entity_id: sensor.lumi_lumi_weather_humidity_3
    below: input_number.ensuite_humidity_threshold

Reference: Numeric State Condition