Relay on ceiling

The diagram helps. I’m sure it would trigger more discussions.

EDIT: Indeed there were more discussions already.

If anyone is interested, I flashed 4 Sonoff Basic R4 relays with ESPHome and got magic Switch Mode working beautifully. Took some tuning of “timeout” parameter, because my switches produce ca 4000 μs gap when wired this way and I think the magic_switch component’s default is 12000 μs, but otherwise smooth sailing.

As you were interested - this is how i connected it:
95c217867197c72192e5a9d73009dbaf5d82a397

Basic R4 is installed inside the ceiling lamp fixture.
When switched, Basic R4 detects a ~4000 μs gap in Live and toggles the relay. So switch continues to work and I have control from HA.

2 Likes

4ms, really short. How is esphome taking care of the sensing? Interrupt call with tiny debounce?

That’s a great solution, thanks!

What I can’t figure out is what happens to the ESP32 when the power briefly goes down while the SPDT switch is being flipped? Is it so short that the CPU just keeps chugging, or is there some sort of battery or capacitor storage to see it through the drop? Just curious.

Some explanation here

And just bridging the wire on 1 switch is enough

Yeah, i did not really draw it, the pic was from Sonoff materials :slight_smile:
And they have one wire between switches - then you need to bridge twice.

You wrote ~4000 μs.

ok, that explains a lot.

yeah, sorry

Hello,
I solved this problem by using the Zigbee switch modules from Girier, also mounted in the cealing. They have 4 contacts instead of the usual 5. There is only one input on which to connect directly the wire which comes from the switch. Werks perfect!

Are you sure? These seem to be regular zigbee relays with switch input that require permanent live to power. How do you power them?

Hi,
My assumption is that at the ceiling lamp a neutral wire is available, going to the lamp and a live wire to the rocker-switch. The switched wire coming back from the rocker normally goes to the lamp.
In my case the ceiling lamp is mounted on a connection-box in the ceiling where you have your Live, Neutral and the wire coming from your rocker-switch. Here you can pick live and neutral for your module. And the wire from the rocker-switch goes to the input of the module and the relay output to the lamp.
If you don’t have these 3 wires available in the ceiling above the lamp, then this is not the solution for you.

Regards,
Arno

You are assuming existence something that this thread is specifically about the absence of :wink:

Scroll back a little.

Neutral goes directly to the ceiling. No permanent neutral in switch box.
Live goes to switch box. From switch to ceiling. No permanent live on ceiling.

Arno, see OP’s sketch above - you would understand that at the lamp location, yes, the neutral is available, however the live wire is not always energized. Also the neutral wire does not go to switch.

So, unless I misunderstood, I don’t think you solved the problem that OP has (or had).

Also, the thread is marked solved.