Toggle a scene then back again?

Hello, I’m not sure if this is possible?
I have a 3d printer and I want to make a lightbulb flash green for 2 seconds then go back to the state it was in before, sometimes that might be on, sometimes off, maybe its on and dim, maybe its on and orange etc

Is it possible to call a scene then revert back to how it was before?
This would be good for buttons too so i can call a scene called “red” that turns my lights red then pressing it again turns them back? is there a phrase I’m missing to search for tutorials on how to do this. all the videos I’ve come across on youtube only talk about making a light turn on or off but nothing to do with remembering states

Thank you

Probably best option would be to create a scene on the fly: