How to wire a solid state relay according to code
You can mix Class 2 conductors with power conductors in boxes if the power circuit conductors are introduced solely to connect to the equipment connected to the Class 2 circuit.

Class 2 circuits voltage and current limits are well-defined by National Electrical Code (NEC.) Also, NEC defines spacing between the class 2 conductors and power inductors. 

See NEC article 725 for more.