Motion Lighting Control Save Current Status

I would love to see an app that helps me with this issue (any help is greatly appreciated!). I have a number of lamps controlled by smart outlets in my living room. I want to be able to have them all turn on when motion is detected, and turn off after 10 mins of no motion. HERE IS THE KICKER - when motion is detected again, I would like only the lights that were on before the app turned them all off to come back on. Additionally, I would love the app to default back to turning on all lights on motion if there is no motion for a longer period when motion is triggered (say, an hour).

Example:

  1. Enter room, all lights turn on
  2. Person decides they want a couple of lamps turned off, and does so manually using smart switches
  3. Exit room
  4. After 10 mins (customizable) , all lights turn off
  5. If the person comes back in within an hour (customizable), lights return to previous status, if longer than that return to default status (all lights on)

Is this possible using existing apps? Maybe using CoRE?

Thanks for any help!

I think you could do it with Core by setting variables in Core to remember which lights were on or off and then recalling this when the sensor is triggered.

I’m kind of new at this and can’t think of how best to set that up - any pointers for doing that in Core?