Help troubleshoot a problem related to smoke sensor MQ6 for a project

I am trying to make a project based on home security which have all the sensor in a single nodemcu. My pin connection for each devices are:

fire sensor - D0 ->D0
ir sensor - out -> D7
buzzer - + -> D6
servo - ORANGE = OUTPUT -> D1
RED = VCC
BROWN = GND
smoke - A0 -> A0

Issue is that when I connect the smoke sensor individually then I can access all the data easily but when all the device are connected together then all the device works fine except for smoke sensor. Instead of the value of intensity of smoke only 0 value is seen. How to solve this problem?

Here is my complete code

// C++ code

#include <Firebase.h>
#include <FirebaseArduino.h>
#include <FirebaseCloudMessaging.h>
#include <FirebaseError.h>
#include <FirebaseHttpClient.h>
#include <FirebaseObject.h>
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include <Servo.h>
#define FIREBASE_HOST "firebase_url"  //original code has values
#define FIREBASE_AUTH "authentication-key"
#define WIFI_SSID "Trunish"
#define WIFI_PASSWORD "TrDeRi31424"
int irVal = 1;
int fireval = 1;
int power = 0;
int freq = 10;
int buzPin = 12; // choose pin for the LED
int irPin = 13;
int servoPin = 5;
int firePin = 16;
Servo servo;
int angle = 0;


void setup()
{
  pinMode(buzPin, OUTPUT);
  pinMode(irPin, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(firePin, INPUT);
  servo.attach(servoPin);
  Serial.begin(115200);

  // connect to wifi.
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(100);
  }
  Serial.println();
  Serial.print("connected: ");
  Serial.println(WiFi.localIP());

  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);

}

void loop()
{
  power = Firebase.getFloat("power");
  //Serial.print("Power" + power);
  // read the state of the pushbutton
  irVal = digitalRead(irPin);
  int fireVal = digitalRead(firePin);
  int smokeVal = digitalRead(A0);
  Serial.print(smokeVal);

  if (power == 1) {

    if (irVal == HIGH ) {
      //Serial.print(irVal);
      servo.write(90);
      Firebase.setFloat("ir", irVal);
      digitalWrite(LED_BUILTIN, LOW);
      tone(buzPin, freq);
    }

    else if (fireVal == 0) {
      //Serial.print(fireVal);
      Firebase.setFloat("fire", fireVal);
      digitalWrite(LED_BUILTIN, LOW);
      tone(buzPin, freq);
    }
    else if (smokeVal > 700)
    {
      tone(buzPin, freq);
      Serial.print(smokeVal);
      Firebase.setFloat("smoke", 1);
      //digitalWrite(5,HIGH);
    }

    else {

      if (irVal == LOW ) {
        //Serial.print(irVal);
        Firebase.setFloat("ir", irVal);
      }

      if (fireVal == 1) {
        //Serial.print(fireVal);
        Firebase.setFloat("fire", fireVal);
      }

      if (smokeVal < 700)
      {
        Serial.print(smokeVal);
        Firebase.setFloat("smoke", 0);
        //digitalWrite(5,HIGH);
      }
      digitalWrite(LED_BUILTIN, HIGH);
      //Serial.print(irVal);
      //Firebase.setFloat("ir", irVal);

      noTone(buzPin);

      // handle error
      if (Firebase.failed()) {
        Serial.print("setting /number failed:");
        Serial.println(Firebase.error());
        return;
      }
    }

  }
  else {
    Firebase.setFloat("ir", irVal);
    Firebase.setFloat("fire", fireVal);
    Firebase.setFloat("smoke", 0);
    noTone(buzPin);
    servo.write(0);
  }
  // Delay a little bit to improve simulation performance
}

Hello rivaadv
Try unknotting the IF and ELSE IF statements.
I have not been able to do it without losing the intended logic.

There must be a wiring error

As I said when I try to run the smoke sensor alone using the same wiring connection then it is working fine but after integration it is not.

Here is the code when i try to do it alone

#include <ESP8266WiFi.h>
#define WIFI_SSID "Trunish"
#define WIFI_PASSWORD "TrDeRi31424"

void setup() {
  // put your setup code here, to run once:

  Serial.begin(9600);
  pinMode(12,OUTPUT);
  
}

void loop() {
  // put your main code here, to run repeatedly:
  int n = analogRead(A0);
  Serial.println(n);

  if(n>700)
  {
    tone(12,100);
    //digitalWrite(5,HIGH);   
  }
  
  if(n<700)
  {
      noTone(12);
      //digitalWrite(5,LOW);
  }
}

When you do it alone, are all the other sensors and servo connected or disconnected?

Found the issue was writing digitalRead(A0) instead of analogRead(A0) when using a analogpin