I want to start working on projects that directly interface with the mains in my house. I know this is dangerous. I don't want to design something that will fail in a year and burn down my house. We had one lecture on mains electricity in my EE program. So I basically know a bit about inductive and capacitive loads, and that is about it.

Things I would be interested in learning:

-Directly power a microcontroller from the mains lines.

-Sense power running in a line

-Switch loads

-DIM lights from a micro

I want to do this properly. What classes could I take that would teach the appropriate knowledge?