GPIO Input fluctuating between high and low when no input is received
Add a pull-up or pull-down resistor. Try 10k. If that doesn't work, try 1k. My guess is that your long wire is picking up some EMI and the very high impedance GPIO pin is converting that to a high enough voltage to change the pin state. A pull-up or pull-down resistor will make this more difficult.