Hi there,
i am sorry to bother you, but i have spent so many hours to figure it out myself, but can not get it done, also i am newbie to arduino. Everything is working except this section that i would like to publish to Mqtt.
thank you for some advice...
String CalculateIAQ( byte score){
String IAQ_text = "Air quality is ";
score = (100-score)*5;
Serial.print("Current score is: ");
Serial.println(score);
if (score >= 301) IAQ_text += "Hazardous";
else if (score >= 201 && score <= 300 ) IAQ_text += "Very Unhealthy";
client.publish("home/livingroom/airquality", 5 );
else if (score >= 176 && score <= 200 ) IAQ_text += "Unhealthy";
client.publish("home/livingroom/airquality", 4 );
else if (score >= 151 && score <= 175 ) IAQ_text += "Unhealthy for Sensitive Groups";
client.publish("home/livingroom/airquality", 3 );
else if (score >= 51 && score <= 150 ) IAQ_text += "Moderate";
client.publish("home/livingroom/airquality", 2 );
else if (score >= 00 && score <= 50 ) IAQ_text += "Good";
client.publish("home/livingroom/airquality", 1 );
homekit_Bme680-delete.ino (9.45 KB)