Impulse relay with neutral on push button

Hi,

i want to replace my impulse relay with a sonoff mini or any tasmota relay device and detect push button impulse. But my installation have neutral on button as show in the figure below:

cablage

So, i used a 1 channel 230V optocoupler isolation on push button

and some magic tasmota commands:

Backlog ButtonTopic 0; SetOption1 1; SetOption73 1; SetOption32 20
Backlog Rule1
  ON button1#state=10 DO power1 2 ENDON
  ON button1#state=3 DO publish domoticz/in {"idx": xxxx,"nvalue":1} ENDON
  ON button1#state=11 DO publish domoticz/in {"idx":xxxx,"nvalue":1} ENDON
Rule1 1

i m able to command:

  • the light with a single press
  • any other device with multi short presses (up to 5) or a long press

https://tasmota.github.io/docs/Buttons-and-Switches/#multi-press-functions

The main difficulty is to have access to neutral wire for sonoff relay but it can be overcome with a no neutral module or the magic 4 diodes tricks (see on youtube)

Have fun =)

ps: take care when handling electrical wires and bare live parts (like under optocoupler)