     ESP.restart();
     delay(5000);
   }
+
+  // always start configportal for a little while
+  wm.setConfigPortalTimeout(60);
+  wm.startConfigPortal("AutoConnectAP","password");
 
   //if you get here you have connected to the WiFi
   Serial.println("connected...yeey :)");

    json["mqtt_port"]   = mqtt_port;
    json["api_token"]   = api_token;

    json["ip"]          = WiFi.localIP().toString();
    json["gateway"]     = WiFi.gatewayIP().toString();
    json["subnet"]      = WiFi.subnetMask().toString();

    File configFile = SPIFFS.open("/config.json", "w");
    if (!configFile) {

  wm.addParameter(&custom_api_token);

  // set static ip
  // IPAddress _ip,_gw,_sn;
  // _ip.fromString(static_ip);
  // _gw.fromString(static_gw);
  // _sn.fromString(static_sn);
  // wm.setSTAStaticIPConfig(_ip, _gw, _sn);

  //reset settings - wipe credentials for testing
  //wm.resetSettings();
