https://diy.stackexchange.com/questions/145791/how-bad-is-it...
In a nutshell, it takes time for the refrigerant pressure to equalize. An AC with a thermostat will have a timer to prevent an immediate restart after a stop.
Another option is to introduce hysteresis into your control loop as the TFA author has done: Use a distinct power threshold from your off threshold. By setting the power on a couple of degrees higher than the cutoff, it will give the refrigerant pressure time to settle.
To the author: I agree with the other posters. Looks the AC already has a thermostat, just no automatic fan control.