So, the HA you want to use with remote rpi, cannot run with cron tab calling the .py program which is confusing the RPi. The problem you last had is that you configured HA as binary sensor, but connected a relay to the pin. If you had set it up as a switch, which it needs to be if wired to a relay, it would have switched the relay on and off, based on the wiring you sent. The state of the relay would be shown in HA. The relay pulled the sensor pin you set-up low, and showed it as on. because a small amount of current is leaking to ground through the relay optical isolator circuit. You don’t need a binary sensor as HA will show you if the relay is on or off. If you want guaranteed that the relay is actually powering the pump, then you will need to set-up some sort of binary, seperately to see the voltage at the pump is on.