Sonoff ESP8266 GPIO flickering
The internal pullups on the ESP8266 chip are pretty lame, on the order of 100K.  This is fine for most switches and sensors connected directly to the device.  If you have any length of wire, say for a wall switch on the other side of the room, the GPIO will be responding to random noise generated in the wiring.  That's why an additional pull-up is needed.  Values from 4K7 to 27K should help.