 RelayrClient remoteClient;
 
 float readTemp() {
-  return dht.getTemperature();
+    return dht.getTemperature();
 }
 
 void cool() {
     lastCoolingTime = lastCoolingTime < 1 ? millis() : lastCoolingTime;
   
    if (millis() - lastCoolingTime > COMPRESSER_DELAY) {
-     digitalWrite(COOL_PIN, LOW);
+     digitalWrite(COOL_PIN, HIGH);
      lastCoolingTime = millis();
    } 
    
-   digitalWrite(HEAT_PIN, HIGH);
+   digitalWrite(HEAT_PIN, LOW);
 }
 
 void heat() {
-  digitalWrite(HEAT_PIN, LOW);
-  digitalWrite(COOL_PIN, HIGH);
+  digitalWrite(HEAT_PIN, HIGH);
+  digitalWrite(COOL_PIN, LOW);
   lastCoolingTime = 0;
 }
 
 void stop() {
   lastCoolingTime = 0;
-  digitalWrite(HEAT_PIN, HIGH);
-  digitalWrite(COOL_PIN, HIGH);
+  digitalWrite(HEAT_PIN, LOW);
+  digitalWrite(COOL_PIN, LOW);
 }
 
 void control(float temp) {
-  if (temp + TEMPERATURE_CONTROL_RANGE < targetTemp) {
+  if (temp + TEMPERATURE_CONTROL_RANGE < targetTemp && targetTemp < MAX_TEMP) {
     heating = true;
     cooling = false;
-  } else if (temp - TEMPERATURE_CONTROL_RANGE > targetTemp) {
+  } else if (temp - TEMPERATURE_CONTROL_RANGE > targetTemp && targetTemp > MIN_TEMP) {
     heating = false;
     cooling = true;
   } else {

    remoteClient.loop();
    
    if (millis() - lastPublishTime > publishingPeriod) {
      lastPublishTime = millis();
      remoteClient.publishTemperature(temp);
      delay(200);
      remoteClient.publishSetTemperature(targetTemp);

#define PASSWORD "pwd"

#define DEFAULT_TARGET_TEMP 19
#define MAX_TEMP 29
#define MIN_TEMP 2

#define COOL_PIN 14
#define HEAT_PIN 13
#define DHTPIN 12

#define TEMPERATURE_CONTROL_RANGE 1
