Since you are using 24volt AC a Traic would be needed and not a transistor. Traics are used to switch AC devices. Watch this video it has a circuit. I like the MOC3041 because it fully isolates the micro controller from the load. AC load interface to Microcontroller - YouTube
Don