ESPHome and native code parallel?

Good morning everyone, I have a question to which Google has given me very contradictory answers.
The following situation: I have a stone old STR two-wire intercom (apartment, apartment building). Since this only has a cruel buzzer built in that you can’t hear anywhere, I built myself a “bell detection” via ESP8266 and an optocoupler. This one transmits its signal via direct connection to a second ESP8266 to make some LEDs flash.
The concrete question now is:
If I run ESPHome on the ESP8266, can I still keep the original code active?
Problem is the following (tested):
If I send the signal from ESP1 to ESP2 directly, there is no delay.
If I let the signal run over the normal WiFi network, then I have a delay from ringing to notification of up to five seconds. Signal comes in, interrupt deep sleep, establish WiFi connection, send signal to second ESP. And we all know, for example, Hermes :wink:
But now I would like to get a notification to the cell phone and into a “ring log” via ESPHome, but don’t want to give up the fast direct connection between the ESPs.
Thanks a lot :slightly_smiling_face:

Not without a bit of effort (you’d have to add your old code to the ESPHome YAML and it’s not super- straightforward). For something like this, there’s no reason to go that route.

My bigger question, is why do you have 2 ESPs for such a simple thing? It’d be pretty trivial to have it all in ESPHome on one device. Code for the optocoupler should be a couple lines: the majority of your YAML will just be the basic setup stuff.

The need for two ESPs is, that the receiver is one floor up and more than 15 meters away in the living room, whilst the sender is at the entrance door. Since i switched to HA, it was the most cost effective solution. Both ESPs, some LEDs and the optocoupler were less than 6€. Plus some cents for the self printed cases.

I also wonder…wouldn’t it be easier to connect the optocouler to the buzzer :thinking:

Or directly to GPIO pin?

And then use Frenck’s doorbell?

Is this not a wired connection? I’m getting kind of lost at what exactly you have going on?

If they indeed need to be two separate devices both on WiFi, it would still be very easy to run ESPHome on both. There’s no reason that there’d be any noticeable delay running an automation in HA to flash the LEDs when the buzzer is pressed. I have TONS of automations where one device causes another to do something and it’s instantaneous.

As i said in my first reply, the first ESP, with the optocoupler, is direct beside the intercom next to the door. The second ESP, the receiver with the LEDs, is in the living room one floor up and about 15 meters away.
Because we cannot hear the buzzer in the intercom in the living room.

So, when both ESPs are connected via ESPHome, there is no noticable delay between ringing the doorbell and the signaling on the 2nd ESPs LEDs? Normal WiFi connection, through the router, had a massive delay up to five seconds. Only the ad-hoc connection between the two works instantly in my case. But i did not try it with ESPHome yet. This is because i am asking.

Only concern would be if it’s an issue with your WiFi. As I said, everything should be instant (from a human’s perspective at least :wink: ).

No super straightforward? He’s just reading an optocoupler and it’s either a high or a low signal.it doesn’t get any more straightforward than that.