You schedule the function every time you call it.
What you need to do is to cancel that schedule.
Right now, you have no way of doing that because the schedule isnt stored anywhere. What you're going to want to do is take the schedule, put it in a variable, and then use the cancel() function later on the schedule to delete it. The flow of your program would kinda look like this .
//All code is loaded up and ready to go.
lightloop(); //The first call
//Now we're running LightLoop
commandToServer('Light');
$lightLoopSched = schedule(1000,0,LightLoop); //We set the newly created schedule to our variable
//After 1 second
commandToServer('Light');
$lightLoopSched = schedule(1000,0,LightLoop); //Old schedule expired and we have a new one, so put this on in the variable now
//After 1 second
commandToServer('Light');
$lightLoopSched = schedule(1000,0,LightLoop);
//After 1 second
commandToServer('Light');
$lightLoopSched = schedule(1000,0,LightLoop);
//Sometime before the schedule expires and the function runs
cancel($lightLoopSched);
//The function doesnt run again because you stopped the schedule from expiring and running the function again.
//Code ends here
A few more things to note.
You can put the cancel function in another function if you want, it might make things easier or it might not.
Its good practice if you have a function that loops itself by schedule, whenever you enter, it cancels any outstanding schedules of itself. If you identically call the function twice you may end up getting two schedule loops so it helps to prevent any of that from ever occurring.