You cannot use it to switch 24 V, dimming, the transformer can be controlled on the primary side if the transformer can do this, if it is a real transformer there is no problem, if it is an electronic transformer you have to read the instructions to see if it can do this. If you are switching too little power, you also need the corresponding resistor. Ask an electrician for advice if you are not sure.