Alternatives to MID400
An ordinary optocoupler should work fine. Only difference is it will only operate on positive half cycles. So just wait for > 20 ms between detecting pulses before deciding that the thermostat is off.

The circuit looks like this:-







simulate this circuit &ndash; Schematic created using CircuitLab

D2 is required to protect the LED from reverse voltage.