Help with compile errors

Ok, i am a complete noob and trying to implement some code from an instructable. The author has been helping a bit, but is rather busy... so i was hoping the comminutiy could help me with working out why this code wont work...

The instructable is this Hacking LG Ducted

This GitHub

It is an ESP8266 board that i have setup and successfully got the blink program /code to compile and work.

I'm using the LOLIN(WEMOS) D1 R2 & mini board and Arduino IDE 2.0.2

Apologies for the code and errors here, I'm new and cannot upload the files instead.

#include <SoftwareSerial.h>
#include <PubSubClient.h>
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiClient.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include "helpers.h"
#include "global.h"

SoftwareSerial swSer;

WiFiClient espClient;

volatile long lastCharTime = 0;
volatile long lastMasterRx = 0;
volatile long lastHeadRx = 0;
int charCount = 0;
unsigned char charBuff[13];
unsigned char charBuffNew[13];

unsigned int checksum1 = 0;
unsigned int checksum2 = 0;
unsigned int lastChecksum = 0;

byte powerByte = 0;
byte fanByte = 0;
byte modeByte = 0;
byte tempByte = 0;
byte zoneByte = 0; 

long previousMillis = 0;       // will store last time loop ran
long interval = 5000;           // interval at which to limit loop
int i;

long previousMQTTCommand = 0;
int waitForCommand = 2000;
boolean changeWaiting = 0;
boolean justChanged = 0;

char id[5];

//MQTT
PubSubClient MQTTClient(espClient);
char subPath[] = {'h', 'a', '/', 'm', 'o', 'd', '/', 'F', 'F', 'F', 'F', '/', '#','\0'};


//*******************************
//      FUNCTIONS
void ConfigureWifi()
{
  Serial.println("Configuring Wifi");
  WiFi.begin (config.ssid.c_str(), config.password.c_str());
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected");

  if (!config.dhcp)
  {
    WiFi.config(IPAddress(config.IP[0],config.IP[1],config.IP[2],config.IP[3] ),  IPAddress(config.Gateway[0],config.Gateway[1],config.Gateway[2],config.Gateway[3] ) , IPAddress(config.Netmask[0],config.Netmask[1],config.Netmask[2],config.Netmask[3] ));
  }
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP());
 Serial.print("Serial: ");
 Serial.println(ESP.getChipId());
 Serial.print("MQTT ID: ");
  
 unsigned long espChipId = ESP.getChipId();
 char b[7];
 sprintf(b, "%i", espChipId);
 for (int i=0;i<4;i++){
  id[i] = b[i+3];
 }
 Serial.println(id);

 // Redefine the ID path
 for (int i=0;i<4;i++){
   subPath[i+7] = id[i];
 }
}

void callback(char* topic, byte* payload,unsigned int length) {
    Serial.print("R: ");
	Serial.print(topic);
	Serial.print(" ");
	Serial.println(payload);
    // If there has been no MQTT message received for a bit
    // assume the data we have is stale and recompile the array
  
    if((millis() - previousMQTTCommand > waitForCommand) && (changeWaiting == 0)) {
      previousMQTTCommand = millis();
      //Copy the existing AC config bytes
      for (int i = 0; i < 13;i++){
        charBuffNew[i] = charBuff[i];
      }
    }
  
    if (topic[11] == '/' && topic[12] == 'X'){ 
      //its a command that needs to be sent to the BUS
      // modify the array with the right settings.
      
      if (topic[13] == 'Z'){
        changeWaiting = 1; // Flag for sensing there is a change to be sent to the BUS
        //Serial.println("Zones");
        if (payload[3] == '1'){
          bitWrite(charBuffNew[5],3, 1);
        }else{
          bitWrite(charBuffNew[5],3, 0);
        }
        if (payload[2] == '1'){
          bitWrite(charBuffNew[5],4, 1);
        }else{
          bitWrite(charBuffNew[5],4, 0);
        }
        if (payload[1] == '1'){
          bitWrite(charBuffNew[5],5, 1);
        }else{
          bitWrite(charBuffNew[5],5, 0);
        }
        if (payload[0] == '1'){
          bitWrite(charBuffNew[5],6, 1);
        }else{
          bitWrite(charBuffNew[5],6, 0);
        }
        //Serial.println(charBuffNew[6],BIN);
      }
      if (topic[13] == 'M'){
        changeWaiting = 1;
        if (payload[0] == '0'){  //Cooling
          bitWrite(charBuffNew[1], 2, 0);
          bitWrite(charBuffNew[1], 3, 0);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '1'){  //Dehumidify
          bitWrite(charBuffNew[1], 2, 1);
          bitWrite(charBuffNew[1], 3, 0);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '2'){  //Fan only
          bitWrite(charBuffNew[1], 2, 0);
          bitWrite(charBuffNew[1], 3, 1);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '3'){  //Auto
          bitWrite(charBuffNew[1], 2, 1);
          bitWrite(charBuffNew[1], 3, 1);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '4'){  //Heating
          bitWrite(charBuffNew[1], 2, 0);
          bitWrite(charBuffNew[1], 3, 0);
          bitWrite(charBuffNew[1], 4, 1);
        }
      }
      if (topic[13] == 'T'){
        //Serial.println("Temp");
        changeWaiting = 1;
        char tmpChar[3] = {payload[0],payload[1], '\0'};  // Convert it to a null terminated string.
        unsigned int tempval = atoi(tmpChar)-15;  // Take off the offset of 15 Degrees.
        bitWrite(charBuffNew[6], 0, bitRead(tempval, 0));  // Write the bits
        bitWrite(charBuffNew[6], 1, bitRead(tempval, 1));
        bitWrite(charBuffNew[6], 2, bitRead(tempval, 2));
        bitWrite(charBuffNew[6], 3, bitRead(tempval, 3));
      }
      if (topic[13] == 'F'){
        changeWaiting = 1;
        if (payload[0] == '0'){  //Low
          bitWrite(charBuffNew[1],5,0);
          bitWrite(charBuffNew[1],6,0);
        }
        if (payload[0] == '1'){  //Med
          bitWrite(charBuffNew[1],5,1);
          bitWrite(charBuffNew[1],6,0);
        }
        if (payload[0] == '2'){  //High
          bitWrite(charBuffNew[1],5,0);
          bitWrite(charBuffNew[1],6,1);
        }
      }
      if (topic[13] == 'P'){
        changeWaiting = 1;
        //Serial.println("Power");
        if (payload[0] == '1'){
          bitWrite(charBuffNew[1],1,1);
        }else{
          bitWrite(charBuffNew[1],1,0);
        }
      }
    }
}

byte calcChecksum(){
  unsigned int checksum;
  checksum2 = 0;
  for (int i = 0; i < 12; i++){
    //Serial.print(charBuff[i]);
    //Serial.print(".");
    checksum2 = checksum2 + charBuffNew[i];
  }

    checksum = checksum2 ^ 0x55;
    return checksum - 256;
}

void serialFlush(){
  while(swSer.available() > 0) {
    char t = swSer.read();
  }
} 


void sendConfig(){
  charBuffNew[0] = 40;  // Slave
  charBuffNew[2] = 0;   //Clear out any other misc bits.
  charBuffNew[3] = 0;   //we dont need
  charBuffNew[4] = 0;
  charBuffNew[8] = 0;
  charBuffNew[9] = 0;
  charBuffNew[10] = 0;
  charBuffNew[11] = 0;
  
  //Calculate the checksum for the data
  charBuffNew[12] = calcChecksum();

  //Send it of to the AC
  Serial.println("Sending to AC");

  // ******* Disable serial RX
  swSer.write(charBuffNew,13);
  // ******* Enable serial RX
  
  // Make sure we are not listening to the data we sent - Prurge any data in the RX buffer.
  serialFlush();
}

void mqttConnect() {
  if (!MQTTClient.connected()) {
    Serial.println("Connecting to broker");
    if (MQTTClient.connect(id)){
      Serial.print("Subscribing to :");
      Serial.println(subPath);
      MQTTClient.subscribe(subPath);
    }else{
      Serial.println("Failed to connect!");
    }
  }
}


void publishTopicValue(char* strString, char* value) {
  Serial.print("S:");
  Serial.print(strString);
  Serial.print("/");
  Serial.println(value);
  MQTTClient.publish(strString, value);
}

void publishSettings(){
  //Power
  powerByte = bitRead(charBuff[1],1);

  // Fan speed 0-2 = Low, Med, High
  bitWrite(fanByte, 0, bitRead(charBuff[1],5));
  bitWrite(fanByte, 1, bitRead(charBuff[1],6));

  //Mode 0 = Cool, 1 = Dehumidify, 2 = Fan only, 3 = Auto, 4 = Heat
  bitWrite(modeByte,0, bitRead(charBuff[1],2));
  bitWrite(modeByte,1, bitRead(charBuff[1],3));
  bitWrite(modeByte,2, bitRead(charBuff[1],4));

  //Set Temp - Binary 0011 -> 1111 = 18 - 30 Deg (decimal 3 offset in value, starts at 18, possibly cool can be set at 15?)
  bitWrite(tempByte,0, bitRead(charBuff[6],0));
  bitWrite(tempByte,1, bitRead(charBuff[6],1));
  bitWrite(tempByte,2, bitRead(charBuff[6],2));
  bitWrite(tempByte,3, bitRead(charBuff[6],3));

  //Zone control - Single bits for each zone
  bitWrite(zoneByte,0, bitRead(charBuff[5],3)); //Zone 4
  bitWrite(zoneByte,1, bitRead(charBuff[5],4)); //Zone 3
  bitWrite(zoneByte,2, bitRead(charBuff[5],5)); //Zone 2
  bitWrite(zoneByte,3, bitRead(charBuff[5],6)); //Zone 1

  char strPath1[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'P','\0'};  // Power State
  char strPath2[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'T','\0'};  //Set Temp
  char strPath3[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'M','\0'};  //Mode
  char strPath4[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'Z','\0'};  //Zones
  char strPath5[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'F','\0'};  //Fan

  char tempChar[2] = {powerByte + 48, '\0'};
  publishTopicValue(strPath1,tempChar);
  
  tempChar[0] = modeByte + 48;
  publishTopicValue(strPath3,tempChar);

  tempChar[0] = fanByte + 48;
  publishTopicValue(strPath5,tempChar);

  char charStr[5] = {bitRead(zoneByte,3)+48, bitRead(zoneByte,2)+48, bitRead(zoneByte,1)+48, bitRead(zoneByte,0)+48, '\0'};
  publishTopicValue(strPath4,charStr);

  char tmpChar[3];
  char* myPtr = &tmpChar[0];
  snprintf(myPtr, 3, "%02u", tempByte+15);
  publishTopicValue(strPath2,tmpChar);
  lastChecksum = charBuff[12];
}

//***********************************************

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

  if (!ReadConfig())
  {
    // DEFAULT CONFIG
    config.ssid = "mywifissid";
    config.password = "mywifissidpassword";
    config.dhcp = true;
    config.IP[0] = 192;config.IP[1] = 168;config.IP[2] = 1;config.IP[3] = 100;
    config.Netmask[0] = 255;config.Netmask[1] = 255;config.Netmask[2] = 255;config.Netmask[3] = 0;
    config.Gateway[0] = 192;config.Gateway[1] = 168;config.Gateway[2] = 1;config.Gateway[3] = 1;
    config.mqttserver = "192.168.0.102:1883";
    config.hostname = "AC_Controls";
    WriteConfig();
    Serial.println("General config applied");
  }

  WiFi.mode(WIFI_STA); // Client Mode
  ConfigureWifi();

  //OTA stuff
  ArduinoOTA.setHostname("AC_Controls");
  ArduinoOTA.onError([](ota_error_t error) { ESP.restart(); });
  ArduinoOTA.setPassword((const char *)"Wildside1983");
  ArduinoOTA.begin();

  char *mqtt_server = &config.mqttserver[0u]; //Convert the server string to char array for mqtt client
  
  MQTTClient.setServer(mqtt_server, 1883);
  MQTTClient.setCallback(callback);

  //Set up software serial at 104 baud to talk to AC
  swSer.begin(104,SWSERIAL_8N1,5,4);

  Serial.println("All your AC belong to us");
}

void loop() {
  unsigned long currentMillis = millis();

  //Make sure we are connected to MQTT
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    // Make sure we are connected
    if (WiFi.status() != WL_CONNECTED) {
      ConfigureWifi();
    }
    ArduinoOTA.handle();
    mqttConnect();
  }
   
   if((millis() - previousMQTTCommand > waitForCommand) && (changeWaiting == 1)) {  //We have received one or more updates via MQTT
      //We have received some updates and we need to send them off via serial.

     // how long since last Master update?
     int lastMasterTime = millis() - lastMasterRx;
     int lastHeadTime = millis() - lastHeadRx;
     if (lastMasterTime > 1000 && lastMasterTime < 8000 && lastHeadTime < 50000){
       sendConfig();
       delay(200);
       sendConfig();  //Twice, just to be sure (This is how the factory unit operates...)
       changeWaiting = 0;
     }
   }
   
   MQTTClient.loop();

   if (swSer.available()) { 
     lastCharTime=millis();
     charBuff[charCount] = swSer.read();
     charCount++;
     if (charCount == 13){
       Serial.print("R: ");
       for (int i=0; i < 12; i++){
         Serial.print(charBuff[i],DEC);
         Serial.print(",");  
       }
       Serial.println(charBuff[12],DEC);
       charCount = 0;
       
       if (charBuff[0] == 168){ //Only publish data back to MQTT from the Master controller.
         lastMasterRx = millis(); //Track when we received the last 168 (master) packet
         publishSettings();  //Push it to MQTT
       }
       if (charBuff[0] == 200){  //Track when we received the last 200 (Head unit) packet.
        lastHeadRx = millis();
       }
     }
  }

  if (charCount < 13 && millis() - lastCharTime > 100){
    charCount = 0;  //Expired or we got half a packet. Ignore
  }
}

And the errors...

F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino: In function 'void callback(char*, byte*, unsigned int)':
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:24: error: no matching function for call to 'println(byte*&)'
   91 |  Serial.println(payload);
      |                        ^
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:99:16: note: candidate: 'size_t Print::println(const String&)' (near match)
   99 |         size_t println(const String &s);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:99:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid user-defined conversion from 'byte*' {aka 'unsigned char*'} to 'const String&' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:286,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/WString.h:57:9: note: candidate is: 'String::String(const char*)' (near match)
   57 |         String(const char *cstr);
      |         ^~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/WString.h:57:9: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:286,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/WString.h:57:28: note:   initializing argument 1 of 'String::String(const char*)'
   57 |         String(const char *cstr);
      |                ~~~~~~~~~~~~^~~~
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:100:16: note: candidate: 'size_t Print::println(const char*)' (near match)
  100 |         size_t println(const char[]);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:100:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:101:16: note: candidate: 'size_t Print::println(char)' (near match)
  101 |         size_t println(char);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:101:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'char' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:102:16: note: candidate: 'size_t Print::println(unsigned char, int)' (near match)
  102 |         size_t println(unsigned char, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:102:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'unsigned char' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:103:16: note: candidate: 'size_t Print::println(int, int)' (near match)
  103 |         size_t println(int, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:103:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'int' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:104:16: note: candidate: 'size_t Print::println(unsigned int, int)' (near match)
  104 |         size_t println(unsigned int, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:104:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'unsigned int' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:105:16: note: candidate: 'size_t Print::println(long int, int)' (near match)
  105 |         size_t println(long, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:105:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'long int' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:106:16: note: candidate: 'size_t Print::println(long unsigned int, int)' (near match)
  106 |         size_t println(unsigned long, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:106:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'long unsigned int' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:107:16: note: candidate: 'size_t Print::println(long long int, int)' (near match)
  107 |         size_t println(long long, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:107:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'long long int' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}
In file included from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Stream.h:27,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h:32,
                 from C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Arduino.h:288,
                 from C:\Users\doini\AppData\Local\Temp\arduino-sketch-429072CC31A96907D7DFA08698FC9F98\sketch\MQTT_Aircon_Controller_1_3_ESP8266.ino.cpp:1:
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:108:16: note: candidate: 'size_t Print::println(long long unsigned int, int)' (near match)
  108 |         size_t println(unsigned long long, int = DEC);
      |                ^~~~~~~
C:\Users\doini\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h:108:16: note:   conversion of argument 1 would be ill-formed:
F:\Downloads\MQTT_Aircon_Controller_1_3_ESP8266\MQTT_Aircon_Controller_1_3_ESP8266.ino:91:17: error: invalid conversion from 'byte*' {aka 'unsigned char*'} to 'long long unsigned int' [-fpermissive]
   91 |  Serial.println(payload);
      |                 ^~~~~~~
      |                 |
      |                 byte* {aka unsigned char*}

exit status 1

Compilation error: no matching function for call to 'println(byte*&)'

Welcome to the forum

That is no problem because the preferred way is to post code directly here as you did. Thank you for using code tags

Please edit your post and put the error message in code tags too

i can do that, i thought it was for code only...

Thank you. Despite the name, code tags also make long error messages easier to view and copy as you will see when you add them

It appears to me to have an issue with 'payload' as that's where all the flags on the scroll down the side show up in Arduino IDE 2.0.2

but I've no idea what the issue is?

The problem is the data type of payload

Try this

void callback(char* topic, byte* payload, unsigned int length)
{
  char messageBuffer[30];  //an array of chars to copy payload to
  memcpy(messageBuffer, payload, length);  //copy the payload
  messageBuffer[length] = '\0';  //turn it into a C string
  Serial.println(messageBuffer);  //print it
}

it compiled i think, trying to upload now...

It has uploaded and connected to my Wifi.. but im not getting the expected return in the serial monitor window. It is sopposed to give me the MQTT ID and its IP... all im seeing are these White triangles with a ? inside them...

Check that the baud rate of the sketch matches that of the Serial monitor

thanks... now trying to workout how to set the serial monitor to 104 baud as the preset only goes as low as 300

MQTT is not a text format, therefore it makes no sense to print a payload in the terminal. You need to extract fields from the message and process them

Why???
The baudrate of Serial has nothing to do with these "presets"

104 baud ?

Why ?

What you are setting is the baud rate between the Arduino and the Serial monitor so where does 104 baud come into it ?

That depends on what you are sending of course

The esp is to be connected to an AC controller that runs at 104 baud, i searched the code and found this... so assumed it what the baud rate has been set to???

  //Set up software serial at 104 baud to talk to AC
  swSer.begin(104,SWSERIAL_8N1,5,4);

urgh... ok, i just flicked through them all.. getting text response back now at 115200

It is the baud rate in Serial.begin() in setup() that must match the baud rate in the Serial.monitor

thank you so much. it was 115200. Which is giving me a response in the serial monitor now.

Hi HeliBob...

So it now is running and connects to wifi... but cannot reach my MQTT Broker (eclipse-mosquitto running in docker) running on a Pi4b. I can reach it at the IP and port using MQTT Explorer on my PC and also reach it and subscribe and publish using the MQTT intergration in my Home Assistant setup... but for some reason my code cannot connect to it...

The Serial Monitor output

WiFi connected
IP address: 192.168.0.185
Serial: 10518148
MQTT ID: 1814
All your AC belong to us
Connecting to broker
Failed to connect!

The Code

#include <SoftwareSerial.h>
#include <PubSubClient.h>
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiClient.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include "helpers.h"
#include "global.h"

SoftwareSerial swSer;

WiFiClient espClient;

volatile long lastCharTime = 0;
volatile long lastMasterRx = 0;
volatile long lastHeadRx = 0;
int charCount = 0;
unsigned char charBuff[13];
unsigned char charBuffNew[13];

unsigned int checksum1 = 0;
unsigned int checksum2 = 0;
unsigned int lastChecksum = 0;

byte powerByte = 0;
byte fanByte = 0;
byte modeByte = 0;
byte tempByte = 0;
byte zoneByte = 0; 

long previousMillis = 0;       // will store last time loop ran
long interval = 5000;           // interval at which to limit loop
int i;

long previousMQTTCommand = 0;
int waitForCommand = 2000;
boolean changeWaiting = 0;
boolean justChanged = 0;

char id[5];

//MQTT
PubSubClient MQTTClient(espClient);
char subPath[] = {'h', 'a', '/', 'm', 'o', 'd', '/', 'F', 'F', 'F', 'F', '/', '#','\0'};


//*******************************
//      FUNCTIONS
void ConfigureWifi()
{
  Serial.println("Configuring Wifi");
  WiFi.begin (config.ssid.c_str(), config.password.c_str());
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected");

  if (!config.dhcp)
  {
    WiFi.config(IPAddress(config.IP[0],config.IP[1],config.IP[2],config.IP[3] ),  IPAddress(config.Gateway[0],config.Gateway[1],config.Gateway[2],config.Gateway[3] ) , IPAddress(config.Netmask[0],config.Netmask[1],config.Netmask[2],config.Netmask[3] ));
  }
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP());
 Serial.print("Serial: ");
 Serial.println(ESP.getChipId());
 Serial.print("MQTT ID: ");
  
 unsigned long espChipId = ESP.getChipId();
 char b[7];
 sprintf(b, "%i", espChipId);
 for (int i=0;i<4;i++){
  id[i] = b[i+3];
 }
 Serial.println(id);

 // Redefine the ID path
 for (int i=0;i<4;i++){
   subPath[i+7] = id[i];
 }
}

void callback(char* topic, byte *payload,unsigned int length) 
{
  Serial.print("R: ");
	Serial.print(topic);
	Serial.print(" ");
  char messageBuffer[30];  //an array of chars to copy payload to
  memcpy(messageBuffer, payload, length);  //copy the payload
  messageBuffer[length] = '\0';  //turn it into a C string
  Serial.println(messageBuffer);  //print it
    // If there has been no MQTT message received for a bit
    // assume the data we have is stale and recompile the array
  
    if((millis() - previousMQTTCommand > waitForCommand) && (changeWaiting == 0)) {
      previousMQTTCommand = millis();
      //Copy the existing AC config bytes
      for (int i = 0; i < 13;i++){
        charBuffNew[i] = charBuff[i];
      }
    }
  
    if (topic[11] == '/' && topic[12] == 'X'){ 
      //its a command that needs to be sent to the BUS
      // modify the array with the right settings.
      
      if (topic[13] == 'Z'){
        changeWaiting = 1; // Flag for sensing there is a change to be sent to the BUS
        //Serial.println("Zones");
        if (payload[3] == '1'){
          bitWrite(charBuffNew[5],3, 1);
        }else{
          bitWrite(charBuffNew[5],3, 0);
        }
        if (payload[2] == '1'){
          bitWrite(charBuffNew[5],4, 1);
        }else{
          bitWrite(charBuffNew[5],4, 0);
        }
        if (payload[1] == '1'){
          bitWrite(charBuffNew[5],5, 1);
        }else{
          bitWrite(charBuffNew[5],5, 0);
        }
        if (payload[0] == '1'){
          bitWrite(charBuffNew[5],6, 1);
        }else{
          bitWrite(charBuffNew[5],6, 0);
        }
        //Serial.println(charBuffNew[6],BIN);
      }
      if (topic[13] == 'M'){
        changeWaiting = 1;
        if (payload[0] == '0'){  //Cooling
          bitWrite(charBuffNew[1], 2, 0);
          bitWrite(charBuffNew[1], 3, 0);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '1'){  //Dehumidify
          bitWrite(charBuffNew[1], 2, 1);
          bitWrite(charBuffNew[1], 3, 0);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '2'){  //Fan only
          bitWrite(charBuffNew[1], 2, 0);
          bitWrite(charBuffNew[1], 3, 1);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '3'){  //Auto
          bitWrite(charBuffNew[1], 2, 1);
          bitWrite(charBuffNew[1], 3, 1);
          bitWrite(charBuffNew[1], 4, 0);
        }
        if (payload[0] == '4'){  //Heating
          bitWrite(charBuffNew[1], 2, 0);
          bitWrite(charBuffNew[1], 3, 0);
          bitWrite(charBuffNew[1], 4, 1);
        }
      }
      if (topic[13] == 'T'){
        //Serial.println("Temp");
        changeWaiting = 1;
        char tmpChar[3] = {payload[0],payload[1], '\0'};  // Convert it to a null terminated string.
        unsigned int tempval = atoi(tmpChar)-15;  // Take off the offset of 15 Degrees.
        bitWrite(charBuffNew[6], 0, bitRead(tempval, 0));  // Write the bits
        bitWrite(charBuffNew[6], 1, bitRead(tempval, 1));
        bitWrite(charBuffNew[6], 2, bitRead(tempval, 2));
        bitWrite(charBuffNew[6], 3, bitRead(tempval, 3));
      }
      if (topic[13] == 'F'){
        changeWaiting = 1;
        if (payload[0] == '0'){  //Low
          bitWrite(charBuffNew[1],5,0);
          bitWrite(charBuffNew[1],6,0);
        }
        if (payload[0] == '1'){  //Med
          bitWrite(charBuffNew[1],5,1);
          bitWrite(charBuffNew[1],6,0);
        }
        if (payload[0] == '2'){  //High
          bitWrite(charBuffNew[1],5,0);
          bitWrite(charBuffNew[1],6,1);
        }
      }
      if (topic[13] == 'P'){
        changeWaiting = 1;
        //Serial.println("Power");
        if (payload[0] == '1'){
          bitWrite(charBuffNew[1],1,1);
        }else{
          bitWrite(charBuffNew[1],1,0);
        }
      }
    }
}

byte calcChecksum(){
  unsigned int checksum;
  checksum2 = 0;
  for (int i = 0; i < 12; i++){
    //Serial.print(charBuff[i]);
    //Serial.print(".");
    checksum2 = checksum2 + charBuffNew[i];
  }

    checksum = checksum2 ^ 0x55;
    return checksum - 256;
}

void serialFlush(){
  while(swSer.available() > 0) {
    char t = swSer.read();
  }
} 


void sendConfig(){
  charBuffNew[0] = 40;  // Slave
  charBuffNew[2] = 0;   //Clear out any other misc bits.
  charBuffNew[3] = 0;   //we dont need
  charBuffNew[4] = 0;
  charBuffNew[8] = 0;
  charBuffNew[9] = 0;
  charBuffNew[10] = 0;
  charBuffNew[11] = 0;
  
  //Calculate the checksum for the data
  charBuffNew[12] = calcChecksum();

  //Send it of to the AC
  Serial.println("Sending to AC");

  // ******* Disable serial RX
  swSer.write(charBuffNew,13);
  // ******* Enable serial RX
  
  // Make sure we are not listening to the data we sent - Prurge any data in the RX buffer.
  serialFlush();
}

void mqttConnect() {
  if (!MQTTClient.connected()) {
    Serial.println("Connecting to broker");
    if (MQTTClient.connect(id)){
      Serial.print("Subscribing to :");
      Serial.println(subPath);
      MQTTClient.subscribe(subPath);
    }else{
      Serial.println("Failed to connect!");
    }
  }
}


void publishTopicValue(char* strString, char* value) {
  Serial.print("S:");
  Serial.print(strString);
  Serial.print("/");
  Serial.println(value);
  MQTTClient.publish(strString, value);
}

void publishSettings(){
  //Power
  powerByte = bitRead(charBuff[1],1);

  // Fan speed 0-2 = Low, Med, High
  bitWrite(fanByte, 0, bitRead(charBuff[1],5));
  bitWrite(fanByte, 1, bitRead(charBuff[1],6));

  //Mode 0 = Cool, 1 = Dehumidify, 2 = Fan only, 3 = Auto, 4 = Heat
  bitWrite(modeByte,0, bitRead(charBuff[1],2));
  bitWrite(modeByte,1, bitRead(charBuff[1],3));
  bitWrite(modeByte,2, bitRead(charBuff[1],4));

  //Set Temp - Binary 0011 -> 1111 = 18 - 30 Deg (decimal 3 offset in value, starts at 18, possibly cool can be set at 15?)
  bitWrite(tempByte,0, bitRead(charBuff[6],0));
  bitWrite(tempByte,1, bitRead(charBuff[6],1));
  bitWrite(tempByte,2, bitRead(charBuff[6],2));
  bitWrite(tempByte,3, bitRead(charBuff[6],3));

  //Zone control - Single bits for each zone
  bitWrite(zoneByte,0, bitRead(charBuff[5],3)); //Zone 4
  bitWrite(zoneByte,1, bitRead(charBuff[5],4)); //Zone 3
  bitWrite(zoneByte,2, bitRead(charBuff[5],5)); //Zone 2
  bitWrite(zoneByte,3, bitRead(charBuff[5],6)); //Zone 1

  char strPath1[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'P','\0'};  // Power State
  char strPath2[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'T','\0'};  //Set Temp
  char strPath3[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'M','\0'};  //Mode
  char strPath4[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'Z','\0'};  //Zones
  char strPath5[] = {'h', 'a', '/', 'm', 'o', 'd', '/', id[0], id[1], id[2], id[3], '/', 'F','\0'};  //Fan

  char tempChar[2] = {powerByte + 48, '\0'};
  publishTopicValue(strPath1,tempChar);
  
  tempChar[0] = modeByte + 48;
  publishTopicValue(strPath3,tempChar);

  tempChar[0] = fanByte + 48;
  publishTopicValue(strPath5,tempChar);

  char charStr[5] = {bitRead(zoneByte,3)+48, bitRead(zoneByte,2)+48, bitRead(zoneByte,1)+48, bitRead(zoneByte,0)+48, '\0'};
  publishTopicValue(strPath4,charStr);

  char tmpChar[3];
  char* myPtr = &tmpChar[0];
  snprintf(myPtr, 3, "%02u", tempByte+15);
  publishTopicValue(strPath2,tmpChar);
  lastChecksum = charBuff[12];
}

//***********************************************

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

  if (!ReadConfig())
  {
    // DEFAULT CONFIG
    config.ssid = "JCB_5G";
    config.password = "wildside";
    config.dhcp = true;
    config.IP[0] = 192;config.IP[1] = 168;config.IP[2] = 0;config.IP[3] = 185;
    config.Netmask[0] = 255;config.Netmask[1] = 255;config.Netmask[2] = 255;config.Netmask[3] = 0;
    config.Gateway[0] = 192;config.Gateway[1] = 168;config.Gateway[2] = 0;config.Gateway[3] = 1;
    config.mqttserver = "192.168.0.102";
    config.hostname = "AC_Controls";
    WriteConfig();
    Serial.println("General config applied");
  }

  WiFi.mode(WIFI_STA); // Client Mode
  ConfigureWifi();

  //OTA stuff
  ArduinoOTA.setHostname("AC_Controls");
  ArduinoOTA.onError([](ota_error_t error) { ESP.restart(); });
  ArduinoOTA.setPassword((const char *)"Wildside1983");
  ArduinoOTA.begin();

  char *mqtt_server = &config.mqttserver[0u]; //Convert the server string to char array for mqtt client
  
  MQTTClient.setServer(mqtt_server, 1883);
  MQTTClient.setCallback(callback);

  //Set up software serial at 104 baud to talk to AC
  swSer.begin(104,SWSERIAL_8N1,5,4);

  Serial.println("All your AC belong to us");
}

void loop() {
  unsigned long currentMillis = millis();

  //Make sure we are connected to MQTT
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    // Make sure we are connected
    if (WiFi.status() != WL_CONNECTED) {
      ConfigureWifi();
    }
    ArduinoOTA.handle();
    mqttConnect();
  }
   
   if((millis() - previousMQTTCommand > waitForCommand) && (changeWaiting == 1)) {  //We have received one or more updates via MQTT
      //We have received some updates and we need to send them off via serial.

     // how long since last Master update?
     int lastMasterTime = millis() - lastMasterRx;
     int lastHeadTime = millis() - lastHeadRx;
     if (lastMasterTime > 1000 && lastMasterTime < 8000 && lastHeadTime < 50000){
       sendConfig();
       delay(200);
       sendConfig();  //Twice, just to be sure (This is how the factory unit operates...)
       changeWaiting = 0;
     }
   }
   
   MQTTClient.loop();

   if (swSer.available()) { 
     lastCharTime=millis();
     charBuff[charCount] = swSer.read();
     charCount++;
     if (charCount == 13){
       Serial.print("R: ");
       for (int i=0; i < 12; i++){
         Serial.print(charBuff[i],DEC);
         Serial.print(",");  
       }
       Serial.println(charBuff[12],DEC);
       charCount = 0;
       
       if (charBuff[0] == 168){ //Only publish data back to MQTT from the Master controller.
         lastMasterRx = millis(); //Track when we received the last 168 (master) packet
         publishSettings();  //Push it to MQTT
       }
       if (charBuff[0] == 200){  //Track when we received the last 200 (Head unit) packet.
        lastHeadRx = millis();
       }
     }
  }

  if (charCount < 13 && millis() - lastCharTime > 100){
    charCount = 0;  //Expired or we got half a packet. Ignore
  }
}

Start by replacing the parameters in

  WiFi.begin (config.ssid.c_str(), config.password.c_str());

with the explicit SSID and password strings and test whether the connection works

If it does then there is something wrong with the value of the variables that you use in the sketch. Print them before you try a connection. Are they what you expect ?

By the way, your sketch does not have the ReadConfig() function in it, whatever it does, so I assume that it is one of the header files