   }
 }
 
-/*******************************************************************************
- * Function Name  : setFan
- * Description    : sets the status of the Fan on or off
- * Return         : 0, or -1 if the parameter does not match on or off
- *******************************************************************************/
-int setFan(String status)
-{
-  //update the fan status only in the case the status is on or off
-  if ( status == "on" ) {
-    fanStatus = true;
-    Particle.publish(PUSHBULLET_NOTIF, "Fan on" + getTime(), 60, PRIVATE);
-    return 0;
-  }
-  if ( status == "off" ) {
-    fanStatus = false;
-    Particle.publish(PUSHBULLET_NOTIF, "Fan off" + getTime(), 60, PRIVATE);
-    return 0;
-  }
-
-  return -1;
-}
-
 /*******************************************************************************/
 /*******************************************************************************/
 /*******************************************************************************/


  if ( currentTemp >= (targetTemp + margin) ) {
    //Particle.publish(APP_NAME, "Desired temperature reached", 60, PRIVATE);
    Particle.publish(PUSHBULLET_NOTIF, "Desired temperature reached", 60, PRIVATE);
    thermostatStateMachine.transitionTo(idleState);
  }
}
void heatingExitFunction(){
  //Particle.publish(APP_NAME, "heatingExitFunction", 60, PRIVATE);
  Particle.publish(PUSHBULLET_NOTIF, "Heat off", 60, PRIVATE);
  myDigitalWrite(fan, LOW);
  myDigitalWrite(heat, LOW);
  myDigitalWrite(cold, LOW);

  if (Particle.function("setTargetTmp", setTargetTemp)==false) {
     Particle.publish(APP_NAME, "ERROR: Failed to register function setTargetTemp", 60, PRIVATE);
  }
  if (Particle.function("setFan", setFanStatus)==false) {
     Particle.publish(APP_NAME, "ERROR: Failed to register function setFan", 60, PRIVATE);
  }
  //TESTING_HACK
