 
 
 void setup() {
+  // Enable temperature sensor
+  temp_sensor.begin();
+
   pinMode(LED, OUTPUT);
   Serial.begin(74880);
   delay(10);

#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

#define WLAN_SSID   "YOUR SSID"
#define WLAN_PASS   "YOUR PASSWORD"

#define SERVER      "minibian"
#define SERVERPORT  1883

#define LED         4
#define DS18B20     5 // Dallas DS18B20 digital thermometer


unsigned int 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.
