       i = 0;
 
     }
-    // Check if the brightness setting has been updated
+    // Update the brightness value
     else if (strncmp((char *)onoffsw.lastread, "{\"Brightness\":", 14) == 0 ) {
 
       Serial.print(F("Brightness: "));

      }

      brightness = new_brightness;

    }
  }

  // Update temperature every TMP_INTER minutes
  if (millis() - last_temp_millis > TMP_INTER*60000) {
    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();
}




  // Setup MQTT subscription for onoff feed.
  mqtt.subscribe(&onoffsw);
  
}


