MQTT question

You got it RW!!!!!

The delay was the problem, so instead of putting the 2nd message after the delay I've put it in my else loop and it's working now!!!!

// If motion is detected, turn the onboard LED on:
  if (motionStatus == HIGH){
    motionStatus = 1;
    //Serial.print(motionStatus);
    digitalWrite(LED_PIN, HIGH);
    digitalWrite(RELAY_PIN_1, HIGH);
    //Sending value to OpenHab with MQTT
   Serial.print("The value of motionStatus is: ");
   Serial.println(motionStatus);
   Serial.print("Sending PIR state ");
   Serial.println(presence[motionStatus]);
   String pubString = String(presence[motionStatus]);
   pubString.toCharArray(message_buff, pubString.length()+1);
   client.publish("Boubounouche/Halloween/PIR", message_buff);
   
    delay (10000); // Smoke Machine ON
    trigger = !trigger; // trigger is true
    digitalWrite(LED_PIN, LOW);
    digitalWrite(RELAY_PIN_1, LOW);
    
   
   delay(10000);
  }
  else // Otherwise send MQTT nobody message and turn off relay
  {
    if (trigger == true){
      motionStatus =0;   
      //Sending value to OpenHab with MQTT
      Serial.print("The value of motionStatus is: ");
      Serial.println(motionStatus);
      Serial.print("Sending PIR state ");
      Serial.println(presence[motionStatus]);
      String pubString = String(presence[motionStatus]);
      pubString.toCharArray(message_buff, pubString.length()+1);
      client.publish("Boubounouche/Halloween/PIR", message_buff);
      trigger = !trigger; // trigger is false
    }
    digitalWrite(LED_PIN, LOW);
    digitalWrite(RELAY_PIN_1, LOW);
  }
}