If there is a light switch by one’s bed, and one accidentally moved one’s foot and turned the switch on during shabbos or yom tov, may one benefit from the light that got turned on?
You may benefit from the light. If you didn’t have any intention to turn the light on, your action is categorized as misasek. Although there are poskim that say that by some misasek there would be an issue to benefit from the action, but that is when the person meant to do the action, but he didn’t realize that the action is a melacha, for example he put a pot on the fire and didn’t realize that some of the food inside it wasn’t cooked. In our case though you didn’t intent to do anything at all, therefore there is no issue of benefiting from the action.
R’ Akiva Eiger -8, Oneg Yom Tov O:Ch 20, Pri Megadim M:Z 318-2, Orchos Shabbos 26 ftnt. 38, OZ Nidberu 6-17, Shmiras Shabbos K’hilchoso 10 ftnt. 47, Meohr Hashabbos 1 letter 17 from R’ S. Z. Auerbach zt”l.