       if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
       if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
       // default is 12 bit resolution, 750 ms conversion time
-      celsius = (float)raw * 0.0625;
+      *celsius = (float)raw * 0.0625;
       break;
 
     case 2:
       data[1] = (data[1] >> 3) & 0x1f;
       if (data[2] > 127) {
-        celsius = (float)data[2] - ((float)data[1] * .03125);
+        *celsius = (float)data[2] - ((float)data[1] * .03125);
       }else{
-        celsius = (float)data[2] + ((float)data[1] * .03125);
+        *celsius = (float)data[2] + ((float)data[1] * .03125);
       }
   }
 
-  fahrenheitTemp = calcFahrenheitFromCelsius(celsius);//celsius * 1.8 + 32.0;
+  return;
+}
+
+void checkFreezerScreamerConditions() {
+
   Serial.print("Temp: ");
-  Serial.print(celsius);
+  Serial.print(celsiusTemp);
   Serial.print(" C, ");
   Serial.print(fahrenheitTemp);
   Serial.println(" F");

    lowThreshExceededCounter = 0;
  }
}

OneWire ds = OneWire(D4);  // 1-wire signal on pin D4

unsigned long lastUpdate = 0;
int msConversionDelayInterval = 1000;
int msAdditionalDelayInterval = 4000;
int msTotalDelayInterval = msConversionDelayInterval +  msAdditionalDelayInterval;
int msfiveMinutes = 300000;
int msOneHour = 3600000;

float lowFahrenheitThreshhold = -5.0;
int lowThreshExceededCounter = 0;
int numLowTempViolations = msfiveMinutes/msTotalDelayInterval;

float highFahrenheitThreshhold1 = 25.0;
float highFahrenheitThreshhold2 = 30.0;
int highThreshExceededCounter = 0;

int numHighTempViolations_level1 = 2;
int numHighTempViolations_level2 = msfiveMinutes/msTotalDelayInterval;
int numHighTempViolations_level3 = msOneHour/msTotalDelayInterval;

double fahrenheitTemp = 0.0;
float celsiusTemp;
char publishString[40];

void setup() {
  Serial.begin(9600);
  Time.zone(-8);
  Particle.variable("fahrenTemp", &fahrenheitTemp, DOUBLE);
  // Set up 'power' pins, comment out if not used!
  /*pinMode(D3, OUTPUT);
  pinMode(D5, OUTPUT);
  digitalWrite(D3, LOW);
  digitalWrite(D5, HIGH);*/
}


bool inViolationForExactDuration(int counter, int numAllowedViolations) {
  return counter == numAllowedViolations;
}

void publishViolationEvent(int numViolations, char* eventName) {
  sprintf(publishString,"%.2f", fahrenheitTemp);
  Particle.publish(eventName, publishString);
}

double calcFahrenheitFromCelsius(float celsius) {
  return celsius * 1.8 + 32.0;
}

// up to here, it is the same as the address acanner
// we need a few more variables for this example

void readCelsiusTemp(float* celsius) {
  byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];

  if ( !ds.search(addr)) {
    /*Serial.println("No more addresses.");*/
