I wonder if there is a opto or similar device to detect the presence of 240VAC with isolation.

The first that came to mind was to use an opto isolator with a capacitor and a diode, but thought it may exist something more compact.

I want to check the state of room thermostat that supplies line voltage with the PIC input.

Ioannis