-//#include <Time.h>
 #include <DHT22.h>
 
 #define DHT22_PIN 6

  thresholdLow = env_min + (env_max - env_min) / 20.0f;
  thresholdHigh = env_min + (env_max - env_min) / 2.0f;

  int new_state = FAN_NOCHANGE;
  if (humidity < thresholdLow) {
    new_state = FAN_OFF;


void loop() {
  getValues();

  /*
   * Calculate limits
   */
  
  // clamp the envelope min/max, decay otherwise
  if (env_min > humidity) {
