Latching relay - how to get feedback to OH


I Need some creative Input here concering latching relays (Stromstoßschalter).
Ich have three of them in my rented house wich I want to integrate into OH without making too many changes to the current implemetation - as said, I live here for rent and WAF is also Always a concern.
So I added a relay board controlled by a ESP8266 to the electrical Cabinet which allows me to switch the latching relays through MQTT with OH.

Unfortunately with that way I only get the state of the Lights when OH was the switching instance - as soon as somebody presses a physical switch in one of the Rooms the state changes and OH does not know it did.
So I Need some Kind of Feedback to OH whether the Lights are on or not to be able to fully automate These Lights.
Preferably I’d like to implement this inside the electical Cabinet with the already existing ESP8266 - so I Need to somehow make that ESP able to tell in what state the relay or the mains line to the lights is.

Has anyone already faced & solved the same challenge? Any clever ideas?

Thanks in advance,

The easiest solution is probably to have a current clamp on each output and have some logic on the ESP to detect when current is being used by each circuit. (I use it to detect movement from my garage doors. If you have little and efficient lighting, it might be difficult to detect.)

An better solution would be to replace the relays with relays that have two separate ouputs. (These are intended to switch both phase and neutral simultaneously.) You’d use one of the relay outputs to switch the light (just like it is now) and the second output to the ESP.
Obviously, that requires new relays; you might not want to do that in a rental place.

You could put a small 240VAC to 5VDV or 3.3VDC transformer of each of the output of the relays and use the output of the relay in an input pin or your ESP through an opto-isolator

These transformers are cheap and easy to mount on bread boards

Be SUPER VERY careful when playing with AC.
Did you ask your landlord?
You will be liable if your place goes up in smoke!!

Cool idea, I like it. I just ordered cheap clamps to Play around with - this seems to be the most minimal-invasive method to achive my goal.
Will try it and report back!

Also very good idea, thank you! I’ll see how far I get with the energy clamps - and then might follow your idea.

As for your AC warning - this can’t be repeated often enough! I know what I do - but insureance-wise you are absolutely correct.

Hi guys, i have a similar schemas but my relays have a double contact on the left interrupt 230v , on right i would put a 5v. I search for many days on community’s forum, like “input for a lamp state”, “dynamic icon input lamp state”.
Would anyone suggest me a basic code for reach my goal?
Many thanks


Similar topic

And what is your goal?
Not very clear from your post.
I recommend that you open a new thread and post as much detail as possible.

You’re already using relays. You just need to know when the coils are energized. That will tell you On/Off. SRD-05VDC are already 5V. No need for a transformer if you have a 5V tolerant ESP8266

sorry, you right
the goal would be, know the state of the lamp and modify related icon on sitemap

yes, i get 5v from external power on the mcp23017 board.

now read @rossko57’s link and try … my own resources are limilited… :smiley:

thank to all