How about a mains switch that turns itself completely off. It takes 2 failures for the light to turn on.

The Clapper Wireless Sound Activated On Off Light Switch Clap Detection Perfect For Kitchen Bedroom Tv Appliances 120 V Wall Plug Smart Home
Light switch turns off by itself. Unlike a latching relay the coil cannot set it to the on position. Could be that the contacts in the switch have gotten loose and cant hold the switch in the up position. For example you can use a finger to. The light fixture then cools down and after a few minutes it will come back on. This one by wemo will calibrate itself to any type of light bulb. After your car has failed to pass those 3 test it takes 40 passes in order for the light to turn itself off.
What is happening is the recessed can lights have a high temp safety switch mounted into the top of the enclosure which will turn the light off if it gets too hot. If the switch is flipped on the either you or your wife have a sleep walking problem memory problem ghosts or one of those crazy people living in your closetattic. Omron has released such a thing. If the switch is off and light is on its probably a bad switch. The switch also has some interesting design touches that place it ahead of the competition. When the switch falls down it breaks the circuit and turns off the light.
The answer is yes. When some car system fails to pass a test the check engine light turns on. It is most likely just the switch that needs replacing and not a more involved electrical problem. When the switch falls down it breaks the circuit and turns off the light. This is especially true with light fixtures that use incandescent light bulbs. Could be that the contacts in the switch have gotten loose and cant hold the switch in the up position.
A manual mains switch with a coil inside that will flip it to the off position following the application of 5v for 50ms.