How does trigger logic work?

How does triggering logic work?

For example: an automation that turns on fan when humidity exceeds 50%. When I turn the fan off and the humidity still exceeds the threshold, when does the automation get triggered again?

It will only trigger when crossing (in your example) from below to above 50%. It will not be triggered again until the value falls below 50% and then rises above 50%.

great, thanks!

It depends on the automation’s trigger. What tom_l described applies to the Numeric State Trigger which represents the most common way to detect when an entity’s state value crosses a threshold value.

If you use a State Trigger with a Numeric State Condition then it will behave differently. It can be designed to trigger for any state-change and then the condition checks if it exceeds the threshold value. For your example, it would mean that if you turn off the fan after humidity exceeds 50%, the automation would turn it back on if the humidity is still above 50%. Depending on the application, this may or may not be desirable.