I want to create a small project with an ESP8266 that makes a server call when a thermostat is open or closed. My main problem is detecting the thermostat status.
The electro-mechanical thermostat has two wires going to it, one 220V line and a return line. When closed, the switch passes
200mA 20mA through it, to keep a relay closed. There is no neutral line available. I don't have access to the relay.
For safety and legal reasons I want to have the ESP8266 battery-powered. I could be smart and "leech off" current but charging a battery once a month is not that bad. I also want the detection to be isolated and non-contact, if possible.
One thing I could do is: add a kind of light indicator and use a light sensor to detect that. Not sure if I could make it light in the on-state, but should be straightforward to do for the off-state, with a resistor, LED and diode.
I don't have enough place inside the thermostat housing for a complicated circuit and I want to keep the ESP8266 module outside the thermostat housing, as a clip-on solution.
TL;DR: an easy non-contact way of detecting whether there is mains voltage without a neutral wire, to read by ADC or digital logic.
Edit: Inside one of the thermostats there is a neutral wire available. I guess with a little digging the other one has it as well. The available space inside the thermostat is around 20x20x20mm, so a module like TSP-03 would not fit.
I might switch the scope of the project from contactless to low-voltage, since it's a bit more reliable and easier to use. The idea is to provide two pins, that either have a voltage difference or close a contact (optocoupler). Whatever choice, it has to fit inside that enclosure and provide a safe output.
Edit2: FYI: The relay is in a remote location (fuse box) and triggers a 3-Phase heating element. No use going that route, even if I could. The uploaded picture shows the insides of the thermostat. The available space is on the left side.
The outside dimensions are 65x65x30mm. Another solution would be to completely replace the thermostat with another model that provides WiFi or access to the signal.
A very comprehensive discussion about a similar topic can be found here: https://www.raspberrypi.org/forums/viewtopic.php?f=45&t=9617&start=25 as well as throughout StackOverflow. I've read most of those.