Motion Lighting App - Room Occupancy

Hi, would it be possible to implement an 'occupancy' status, which is set to true for as long as the off delay timer has not expired. I tried setting up an 'occupancy' virtual switch, which would be turned on as if it was a light, however if the lux within the room was above the level I wanted the lights to turn on, then it would not be set to true.

The reason for wanting this flag is in order to allow the initiation of other operations whilst in the bathroom such as play music on Sonos, turn on heating if required etc. These operations will be performed within Rule Manager based on the status of the 'occupancy' virtual switch.

Create a 2nd instance of ML for the tracking purpose? Set your motion sensors and ONLY your virtual switch as the light. Don't use lux level. Would that work?

I'm not sure if @bangali is still around as I haven't seen him post in a while....but his Rooms Manager app was to go to for this type of thing.

Rooms Manager: Smarter Rooms: Personalized home automation with Occupancy

Thanks @jrfarrar for the suggestion. I did have the same idea and will probably go down that path if there is no other alternative.

I have used @bangali room manager app and does more than satisfy my requirements with its features, however I found it to be unreliable. Whether it was issues with the app or with Hubitat I could not be sure.