Ender 3 ignores signal from optocoupler Optocoupler used in conjuction with an inductive sensor on a stock Ender 3, wired like this:

Except I also wired a switch to the Z endstop signal and ground.
I don't know the switch pin layout so I had to guess.

I guess S stands for signal, but I don't know why the other pin isn't G, but rather V. So we have signal and voltage? that doesn't make sense so I guess its the reason for the problem.
When I do auto home all axes, it completely ignores signal from the optocoupler. It only stops when hitting the switch.
The optocoupler is connected to an inductive sensor. When the sensor detects metal, it sends a signal to the optocoupler, the optocoupler to Z limit pins on the mainboard (or so it should).
Video of whats happening is found here.
Should I connect optocoupler VCC to switch V (keep switch S to optocoupler OUT)?

U (not V) is +5V, so should I connect the optocoupler VCC to it?
Not knowing the type of inductive sensor you are using, the most common, an NPN type sensor (like the LJ18A3-8-Z/BX) is assumed (in relation to your previous question). NPN type sensors imply that the signal is held high at a certain voltage (the supply voltage ranges from 6 V-36 V, but are reported to work on 5 V also) and is actively switched down to 0 V when triggered.
Basically the sensor always produces a high signal until triggered. Why is this the preferred option? If somehow the wires break or some issue occurs that triggers the sensor, movement is stopped to prevent damage to occur.
The signal from the sensor needs to be &quot;high&quot; and the switch needs to cut the power by opening the circuit. So make sure what your sensor signal is outputting in the first place. The depicted switch is a powered switch as it uses an LED, but the switching component on the circuit board itself has three pins, COM (COMmon), NO (Normally Open) and NC (Normally Closed). You need to put +5 V on the white wire to power the right side of the optocoupler and connect the switch as such that the COM and the NC are connected (most probably S and U in the depicted switch).