   pinMode(DOOR_PIN, INPUT_PULLUP);
   doorState = digitalRead(DOOR_PIN);
   attachInterrupt(digitalPinToInterrupt(DOOR_PIN), _doorStateChange, CHANGE);
+
+  pinMode(PIR_PIN, INPUT);
+  pirState = digitalRead(PIR_PIN);
 
   startup = false;
 }

MQTT mqtt(RESET_SETTINGS);

#define DOOR_PIN 2
int doorState;

boolean startup = true;
boolean stateChange = false;

void setup() {
  Serial.begin(115200);

    mqtt.publish("alert", json.c_str());    
    stateChange = false;
  }
  if (doorState == HIGH) {
    pirState = digitalRead(PIR_PIN);
    if (pirState == HIGH) {
      String json = "{\"door\": \"CLOSED\", \"motion\": \"DETECTED\"}";
      Serial.print("Alert: "); Serial.println(json);
      mqtt.publish("alert", json.c_str());
    }
  }
  delay(1000);
}

void _doorStateChange() {
