wiring AC switch with DC led
You can do this with direct conversion. Simply use a rectifier, followed by a mains-rated capacitor, then connect this to your LED in series with a very large resistor. You don't need to generate 5 or 12 volts - the series resistor will limit current through the LED. Something like this:







simulate this circuit &ndash; Schematic created using CircuitLab

You could go even lighter weight and use a single resistor and capacitor but for two issues: it would flicker at 60Hz, and most LEDs aren't rated to withstand mains voltage in reverse bias.

Things to look out for:


Remember that rectified mains is 1.41 times the RMS voltage, so spec the DC part of your circuit for 338 (169) volts, not 240 (120).
Size R1 appropriately to the amount of current you want through the diode. In the schematic above, I've sized it to allow 2mA through for 240V mains.
Make sure R1 can handle the power dissipation; in this case it'd be 0.67 watts, so make sure you use a power resistor.
Mains voltages everywhere! Take care, and make sure it's well insulated.