Well my pictures show how you could do it.
1 microcontroller, I took an attiy45
Programm the input pin for the encoder with internal pull-up
duration should be min a few seconds (for debugging) max a few minutes (you want it to go out, not stay on fot an hour)
brightness between 0 and 100% , so you can put it completly out.
desolder 100 ohm smd resistor like in picture , solder transistor to it and to vcc.