💡 Sensor Light - Motion Sensor - Door Sensor - Sun Elevation - LUX Value - Scenes - Time - Light Control - Device Tracker - Night Lights

@deliverer33

Sounds good, here is the code you will be looking for in your script. Once ceated add it into Scenes - Scripts To Turn OFF.

alias: New Script
sequence:
  - condition: state
    entity_id: switch.pool_bathroom_fan_2
    state: "on"
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

If you would like a delay before you turn the fan OFF after the light A is OFF then this.

alias: New Script
sequence:
  - condition: state
    entity_id: switch.pool_bathroom_fan_2
    state: "on"
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.pool_bathroom_fan_2

What happens is in the end of the blueprint automation it turns light A OFF, then it will run the script. The script says if light B (the fan) is ON then turn fan OFF. The second code I gave you just has a delay of 30 min.

Now I know it is a fan for your pool and your removing humidity I would look at my :shower: Bathroom Humidity Exhaust Fan and link it with the light automation. You will need a humidity sensor to turn the fan ON. In the :shower: Bathroom Humidity Exhaust Fan blueprint look at the FAQ and my set up. I think you will love it.

Blacky :smiley: