TLDR:
What kind of electronics would I need to detect 220v mains and use this to trigger GPIO14 on a sonoff basic?
My goal is to have setup where the light switches works as they do now, bu the light is also controllable via mqtt.
In my house (in Denmark) i have light sockets that looks like this picture:
. From this socket I can get both uninterrupted 220v (from M2 and N) as well as a 220v line that is controlled by two switches (a 3-way switch for the americans). My idea is that I can connect the constant line to the In of the sonoff and somehow use the “switched” to toggle the sonoff.
I have managed to flash tasmota on a sonoff, connected it to HA, and I have configured it to toggle the relay when GPIO14 is connected and disconnected from the ground pin. So I am looking for a way to do something like that, but controlled by the 220v mains circuit.
I was wondering about something like this - https://www.ebay.com/itm/240V-220V-AC-Mains-Sensor-opto-isolator-optoisolator-optocoupler-5V-3-3V-Arduino/272619019157 ?