 }
 
 void idleEnterFunction(){
+  //set the state
+  setState(STATE_IDLE);
+
   //turn off the fan only if fan was not set on manually by the user
   if ( internalFan == false ) {
     myDigitalWrite(fan, LOW);

      externalMode = MODE_COOL;
    } else if ( externalMode == MODE_COOL ){
      externalMode = MODE_OFF;
    }
    //start timer to debounce this new setting
    modeButtonClickTimer = 0;
    //flag that the button was clicked
    modeButtonClick = true;
    //update the mode indicator
    Blynk.virtualWrite(BLYNK_DISPLAY_MODE, externalMode);
  }
}

void BLYNK_setFanLed(int status) {
  if (USE_BLYNK == "yes") {
    if ( status ) {

    myDigitalWrite(fan, HIGH);
    myDigitalWrite(heat, HIGH);
    myDigitalWrite(cool, LOW);
    //set the state
    setState(STATE_PULSE_HEAT);
  } else if ( internalMode == MODE_COOL ){
    myDigitalWrite(fan, HIGH);
    myDigitalWrite(heat, LOW);
    myDigitalWrite(cool, HIGH);
    //set the state
    setState(STATE_PULSE_COOL);
  }
  //start the timer of this cycle
  pulseTimer = 0;
