Power goes high on startup @ GPIO2

Hi
My issues is similar to this post seen here.
https://forum.arduino.cc/index.php?topic=496308.0

I have been told to start my own thread, so here i go.

The code words great and all is working as expected, but on power up the ( ESP8266 wifi module ) the GPIO2 output goes high for about two seconds before turning off.

I would prefer this, not to happen

I am not even sure if it is possible to add some extra code lines to stop this from happening on power up.

Sorry but i am not a coder.
although i have read the other post i have tried adding some extra code lines but i was not successful.

Any suggestion i would greatly appreciate your help.

Thank in advance

here is my sketch.

#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
const char* ssid     = "mywifi"; 
const char* password = "mywifipassword";
const char* host     = "192.168.1.10"; // Your domain  
String path          = "/wifiarduino/light.json";
const int pin        = 2;
void setup() {
    pinMode(pin, OUTPUT);
    pinMode(pin, HIGH);
    Serial.begin(115200);
  delay(10);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  int wifi_ctr = 0;
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("WiFi connected");
    Serial.println("IP address: " + WiFi.localIP());
}
void loop() {
    Serial.print("connecting to ");
  Serial.println(host);
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  client.print(String("GET ") + path + " HTTP/1.1\r\n" +               "Host: " + host + "\r\n" +                "Connection: keep-alive\r\n\r\n");
  delay(500); // wait for server to respond
  // read response  
String section="header";
  while(client.available()){
    String line = client.readStringUntil('\r');
    // Serial.print(line);    // we’ll parse the HTML body here
    if (section=="header") { // headers..
      Serial.print(".");
      if (line=="\n") { // skips the empty space at the beginning
         section="json";
      }
    }
    else if (section=="json") {  // print the good stuff
      section="ignore";
      String result = line.substring(1);      // Parse JSON
      int size = result.length() + 1;
      char json[size];
      result.toCharArray(json, size);
      StaticJsonBuffer<200> jsonBuffer;
      JsonObject& json_parsed = jsonBuffer.parseObject(json);
      if (!json_parsed.success())
      {
        Serial.println("parseObject() failed");
        return;
      }
      // Make the decision to turn off or on the LED
      if (strcmp(json_parsed["light"], "on") == 0) {
        digitalWrite(pin, HIGH);
         Serial.println("LED ON");
      }
      else {
        digitalWrite(pin, LOW);
        Serial.println("led off");
      }
    }
  }
  Serial.print("closing connection. ");
}

Which ESP8266 module. There are many.

AFAIK GPIO2 is HIGH during bootup.
Nothing you can do about that.

Use a different IO pin, or use inverted logic for the thing/device you're driving.
Leo..