void callback(String topic, byte* message, unsigned int length) { String messageTemp; for (int i = 0; i < length; i++) messageTemp += (char)message[i]; if (topic == "wetter_display/set") { JsonObject& json = jsonBuffer.parseObject(messageTemp); if (!json.success()) { error = 2; return; } temp_2m = json["Temp_2m"].as(); temp_0m = json["Temp_0m"].as(); pressure = json["Pressure"].as(); humidity = json["Humidity"].as(); dewpoint = json["Dewpoint"].as(); luminosity = json["Luminosity"].as(); wind = json["Wind_kmh"].as(); windr = json["Wind_r"].as(); error = 1; jsonBuffer.clear(); } } void reconnect() { while (!client.connected()) { if (client.connect("WetterDisplay", mqtt_user, mqtt_pass)) { client.subscribe("wetter_display/set"); updatedisplay(); } else { display_error("MQTT Error"); delay(5000); } } }