Need Help on Humidity Fan Automation

Thanks for any help in advance! I have a shower fan and a humidity sensor nearby. When the fan is off and the humidity passes a threshold, I want it to turn on. That part is easy.

If this auto-on is triggered, I want it to continue monitoring and when the humidity returns below the threshold, I want the fan to turn back off.

I cannot create two automations (on and off) because the off won’t know if the fan was manually or auto enabled. How do I add the second part into the same automation, where it continues monitoring on a regular interval (or it gets triggered) to then turn it back off? I am sure it’s a building block or repeat or something, but I haven’t been able to quite figure out the recipe.

You can use a second automation for off with a condition that checks to see if the fan was turned on manually or by an automation. There’s an example of how to store this context when an entity is turned on here: Access to trigger.to_state.context from a different entity? - #3 by tom_l

Have a trigger for fan on with one trigger_id, and another for fan off with a different trigger_id. Trigger is numeric trigger based on above or below the numeric value of the humidity sensor.
As the action make a choose statement with 2 conditions, one that matches one trigger_id and one that matches the other.

That will still have this issue: