           }
           analogWrite(LED, new_brightness);
           i = new_brightness;
-
         }
         else {
           while (i > new_brightness) {
             analogWrite(LED, i);
             i -= 1;
             delay(2);
-
           }
           analogWrite(LED, new_brightness);
           i = new_brightness;

  while ((subscription = mqtt.readSubscription(10000))) {

    if (strcmp((char *)onoffsw.lastread, "{\"On\":1}") == 0 && !led_on) {
      led_on = true;
      Serial.println(F("On"));
      i = 0;

      }

      brightness = new_brightness;

    }
  }

  if (millis() - last_temp_millis > 5000) {
    updateTemperature();
  }
}


void updateTemperature() {
  Serial.print("Requesting temperature...");

  temp_sensor.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
  // After we got the temperatures, we can print them here.
  // We use the function ByIndex, and as an example get the temperature from the first sensor only.
  Serial.print("Temperature is: ");
  Serial.println(temp_sensor.getTempCByIndex(0));

  temperature = temp_sensor.getTempCByIndex(0);

  temp_mqtt.publish(temperature);

  last_temp_millis = millis();
}


// Function to connect and reconnect as necessary to the MQTT server.
