I bought a solid state relay (made of triac with zero crossing detected optocoupler), it turned on/off sine wave AC of Line by 5 volt dc. But it didn't turned off UPS voltage(square wave), it remains always on.
This may be a di/dt issue-there is a limit as to how fast the current in a triac can change (the edge of your squarewave). Not sure, but I'd look at that.