Rookie question: Switch state or something

I have a sketch which, by using a DS18B20 temperature sensor, will turn on a wireless socket switch (with a radiator plugged in) if the temperature is below specified temperature. The ifs inside the loop is posted below. The delays seem necessary for the remote switch to work, so now my sender sends a signal for one second, every two seconds.

I would like to involve a variable which would render unecessary the continued sending of a signal after the switch is on or off. That is, outside the loop, I would have to say something in the lines of "if temperature<19 set status=off" and "if temperature>=19 set status=on" And then in the conditionals I would say "if temperature<19 and status=off, then send the on-signal, and redefine status=on" and similar for the other if. How do I go about this?

My current conditionals:

if(temperature>=19.00) {
delay(1000);
unsigned long sender = 9076822;
unsigned int recipient = 2;
bool command = false;
bool group = false;
homeEasy.sendAdvancedProtocolMessage(sender, recipient, command, group);
}
if(temperature<19.00) {
delay(1000);
unsigned long sender = 9076822;
unsigned int recipient = 2;
bool command = true;
bool group = false;
homeEasy.sendAdvancedProtocolMessage(sender, recipient, command, group);
}

Serial.println(temperature);

delay(2000);

}

Are sender and recipient ever going to change? If not, make them global or static variables, not local to the if block.

A boolean variable that you set when the temperature goes above or below the threshold and one that you set when you turn the switch on or off would seem useful.

No, they are never going to change. How would I do what you suggest in practical terms?

How would I do what you suggest in practical terms?

Highlight the code. Use Ctrl-X and Ctrl-V to relocate it.

bool itsCold = false;
bool iveTurnedTheHeatOn = false;