   Serial.print(timestamp);
   Serial.write(' ');
   Serial.print(string);
+}
+
+// scan 1-wire bus for temperature sensors
+void scan1Wire() {
+  byte addr[8];
+  byte dsIdx = 0;
+
+  ds.reset_search();
+  Serial.print(F("Searching 1-wire...\r\n"));
+
+  while (ds.search(addr) && dsIdx < dsMax) {
+    Serial.print(F("Detected device: "));
+    for (int i = 0; i < 8; i++) {
+      Serial.print(addr[i], HEX);
+    }
+
+    Serial.print(F(" - "));
+    if (OneWire::crc8(addr, 7) != addr[7]) {
+      Serial.print(F("invalid CRC!\r\n"));
+      continue;
+    }
+
+    if (addr[0] == 0x28) {
+      for (int i = 0; i < 8; i++) {
+        dsAddrs[dsIdx][i] = addr[i];
+      }
+      dsIdx++;
+      Serial.print(F("DS18B20 registered\r\n"));
+    } else {
+      Serial.print(F("unknown device ignored\r\n"));
+     }
+  }
+  dsCount = dsIdx;
+  ds.reset_search();
 }
 
 //__attribute__((always_inline))

        doorState = doorOpen;
        break;
      }
    // fall-through to next case

    case doorClosing:
      if (doorState == doorClosing && swFront == LOW) {


  pinMode(pirPin, INPUT);

  // register sensors
  scan1Wire();

  // initialize debounce registers, assume steady state
  swFrontDebounce = (swFront = swFrontDeglitch = digitalRead(switchFront)) * 0xFFFF;
