Isolated way to detect 240V contact closing
If the current passing through the thermostat is AC i.e. 50 or 60 Hz then you could use a small clamp-on current transformer. The current flow will produce a voltage output across a burden resistor and this can be simply amplified to generate a "detect_current" signal.

If the current is DC then use a hall-effect sensor (which you could still use if the current is AC) but it's costlier and a little more tricky sometimes.