   display.drawString(0, 16, "TIME:");
   display.drawString(45, 16, (timeString));
 }
-//UPDATE TEMP FUNCTION (SHITSHOW CODE, BUT IT WORKS)
-//------------------------------------------------------------------------------------------------
-
-void updateTemp() {
-
-  float temperature;
-  String stringVal = "";
-  boolean alertPinState, alertRegisterState;
-
-  // read temperature data and write to OLED screen
-  temperature = sensor0.readTempF();
-  //temperature = sensor0.readTempC();
-
-  // convert temperature float to string
-  stringVal += String(int(temperature)) + "." + String(getDecimal(temperature)); //combining both whole and decimal part in string with a fullstop between them
-  //Serial.print("stringVal: ");Serial.println(stringVal);              //display string value
-
-  char charVal[stringVal.length() + 1];                    //initialise character array to store the values
-  stringVal.toCharArray(charVal, stringVal.length() + 1);  //passing the value of the string to the character array
-
-  //Serial.print("charVal: ");
-  for (uint8_t i = 0; i < sizeof(charVal); i++) //Serial.print(charVal[i]); //display character array
-
-    display.setTextAlignment(TEXT_ALIGN_LEFT);
-  display.setFont(ArialMT_Plain_16);
-  display.drawString(0, 32, "TEMP:");
-  display.drawString(80, 32, "F");
-  display.drawString(48, 32, (stringVal));
-
-  // Check for Alert
-  alertPinState = digitalRead(alertPin); // read the Alert from pin
-  alertRegisterState = sensor0.alert();   // read the Alert from register
-
-  /*
-    // Print temperature and alarm state
-    Serial.print("Temperature: ");
-    Serial.print(temperature);
-
-    Serial.print("\tAlert Pin: ");
-    Serial.print(alertPinState);
-
-    Serial.print("\tAlert Register:  ");
-    Serial.println(alertRegisterState);
-  */
-}
-//function to extract decimal part of float (SUB ROUTINE OF TEMP UPDATE)
-long getDecimal(float val)
-{
-  int intPart = int(val);
-  long decPart = 10 * (val - intPart); //I am multiplying by 1000 assuming that the foat values will have a maximum of 3 decimal places.
-  //Change to match the number of decimal places you need
-  if (decPart > 0)return (decPart);       //return the decimal part of float number if it is available
-  else if (decPart < 0)return ((-1) * decPart); //if negative, multiply by -1
-  else if (decPart = 0)return (00);       //return 0 if decimal part of float number is not available
-}
+
 //FAUXMO CALLBACK FUNCTION add devices here
 //------------------------------------------------------------------------------------------------
 void callback(uint8_t device_id, const char * device_name, bool state) {

void loop() {
  display.clear();     // wipe display clean to refresh it
  updateIP();          // function call for display update
  updateTemp();        // fuction call for TMP102 temp
  updateTime();
  fauxmo.handle();     // call fauxmo device function
  display.display();   // write display buffer
  delay(10);           // loop governor, determine how fast this loop runs
}
//================================================================================================



  //START I2C COMMUNICATION
  display.init();   // SSD12306 - OLED screen start I2C comms
  Serial.println("SSD1306 INIT");
  mcp.begin();      // MCP23017 - I/O Expander start I2C comms

  //Flip Screen orientation in software, (pins on top)
  display.flipScreenVertically(); //SSD12306

  //CONFIGURE PIN USAGE
 
  //set PORT A I/O expander pins to OUTPUTS for relay use
  mcp.pinMode(relayPin_K1, OUTPUT);
  mcp.pinMode(relayPin_K2, OUTPUT);
