Need to trigger code to run from door opening

Of course it's possible. I suggest you start with an arduino and figure out how to tell it you just opened your bedroom door. Then when that works, go to a next step.

Paul