Advice, Bathroom Fan Advanced Automation Logic

Folks -

Using a Leviton RA2 switch where I can see the drepression of the switch, an occurpancy sensor, and a humidity sensor … does thie logic look workable … any idea of how to code the automation?

Bathroom Exhaust Fan Automation

A). MANUAL ACTIVATION via Lutron RA2 Momentary Switch

Lutron RA2 switch is depressed ONCE, and Fan State is OFF

  • ACTION set Fan to ON UNTIL
    • FAN On timer > 15 mins and
      • Occupancy State is not OCCUPIED
      • AND Humidity_Sensor BELOW Humidity target

Lutron RA2 switch is depressed ONCE, and the Fan State is ON

  • ACTION set Fan to OFF
    • IF Humidity_Sensor BELOW Humidity target

Lutron RA2 switch is depressed TWICE, and the Fan State is ON

  • ACTION set Fan to OFF

B). AUTOMATED, SENSED ACTIVATION

Occupancy State is OCCUPIED

  • ACTION set Fan to ON UNTIL
    • FAN On timer > 5 mins and
      • Occupancy State is not OCCUPIED
      • AND Humidity_Sensor BELOW Humidity target