 float targetTemp = 19.0;
 float currentTemp = 20.0;
 float currentHumidity = 0.0;
-float margin = 0.3;
+float margin = 0.25;
 //DHT difference with real temperature (if none set to zero)
 //use this variable to fix DHT measurements with your existing thermostat
 float temperatureDifference = -1.6;

  }

  if ( currentTemp <= (targetTemp - margin) ) {
    Particle.publish(APP_NAME, "Starting to heat", 60, PRIVATE);
    thermostatStateMachine.transitionTo(heatingState);
  }
}
void idleExitFunction(){
  Particle.publish(APP_NAME, "idleExitFunction", 60, PRIVATE);
}

void heatingEnterFunction(){
  Particle.publish(APP_NAME, "heatingEnterFunction", 60, PRIVATE);
  Particle.publish(PUSHBULLET_NOTIF, "Heat on", 60, PRIVATE);
  myDigitalWrite(fan, HIGH);
  myDigitalWrite(heat, HIGH);

  if ( tmpFloat > 0 ) {
    currentTemp = tmpFloat;
    currentTempString = String(currentTemp);
    //Particle.publish(APP_NAME, "New current temp: " + currentTempString, 60, PRIVATE);
    Particle.publish(PUSHBULLET_NOTIF, "New current temp: " + currentTempString, 60, PRIVATE);
    return 0;
  } else {
    //Particle.publish(APP_NAME, "ERROR: Failed to set new current temp to " + newCurrentTemp, 60, PRIVATE);
    Particle.publish(PUSHBULLET_NOTIF, "ERROR: Failed to set new current temp to " + newCurrentTemp, 60, PRIVATE);
    return -1;
  }
}
