Hi,
I have an automation that switches on the fan when humidity is above 70%.
Our bathroom extractor is connected to lights so whenever lights are switched on the fan kicks in and when the lights are switched on the fan keeps running for another 30 minutes.
To the back of the light switch I have fitted a microswitch and that is controlled by HA.
The automation should only start when the humidity is above 70% and lights were turned off for 30 minutes.
However I have noticed that if the bathroom is in use, and the lights are turned on, the automation kicks in and switches the lights off.
I think the combination of your trigger and the mode is the issue here. When you use a State trigger without a defined to:, from:, or attribute: the trigger fires every time the state or any attribute changes.
It also seems like you might be using the wrong event as your trigger. The event in time that would be closest to execution of the action would be the lights being off for 30 minutes. To put it another way… how likely is it that the lights would have already been off for 30 minutes and the humidity climbs from below 70% to above 70%? If you want to cover all the bases, use both as triggers: