Fan Override Motion for Lights

I’ve got the following PLEG to turn on my bathroom lights when it detects motion. I’d like to modify it… Basically, when the fan is on, I’d like to make sure that the lights don’t go off, even if there’s no more motion. And then when the fan is turned off, if there’s no motion, go ahead and turn it off.

(Not MasterBathroomLightOn) and MasterBathroomMotionTripped

(Not MasterBathroomMotionTripped) and MasterBathroomLightAutoOnDetected and (MasterBathroomLightAutoOnDetected; Now > 2:30)

TurnMasterBathroomLightOn; MasterBathroomLightOn < 1:00

I was thinking of doing this:
(Not MasterBathroomMotionTripped) and (Not MasterBathroomFanOn) and MasterBathroomLightAutoOnDetected and (MasterBathroomLightAutoOnDetected; Now > 2:30)

But couple things:

  • That was setting the MasterBathroomMotion to always trigger which was then making the bathroom light always go on. I would turn off th elight in Vera, and then the motion would immediately activate, even with no one in the room. It’s really strange, and I can’t figure out why that would be,
  • The MasterBathroomFanOn is an INPUT that fires when the fan is on… is there a way to catch the state? It appears that I don’t need an event, so much as I need to know if something is currently on.