Wemos pin D4 (ESP8266 GPIO2) has a built-in pull up resistor (for boot select purposes) which fights with the pull down on the 4N25 optocoupler emitter. End result is that the input will never cross the digital signal threshold and register a change in signal.