             case 'P':
                 // CO2
                 snprintf(valstr, sizeof(valstr), "%d PPM", value);
-                mqtt_send(TOPIC_CO2, valstr);
+                mqtt_send(TOPIC_CO2, valstr, true);
                 break;
             case 'A':
                 // humidity
                 snprintf(valstr, sizeof(valstr), "%d.%02d %%", value / 100, value % 100);
-                mqtt_send(TOPIC_HUMIDITY, valstr);
+                mqtt_send(TOPIC_HUMIDITY, valstr, true);
                 break;
             case 'B':
                 // temperature
                 temp10 = (5 * value - 21848) / 8;
                 snprintf(valstr, sizeof(valstr), "%d.%d °C", temp10 / 10, abs(temp10) % 10);
-                mqtt_send(TOPIC_TEMPERATURE, valstr);
+                mqtt_send(TOPIC_TEMPERATURE, valstr, true);
                 break;
             default:
                 // ignore unhandled packet

    zg01_init(buffer);

    Serial.println("Starting WIFI manager ...");
    wifiManager.autoConnect("ESP-ZG01");
}

static void mqtt_send(const char *topic, const char *value)
{
    if (!mqttClient.connected()) {
        mqttClient.setServer(MQTT_HOST, MQTT_PORT);
        mqttClient.connect(esp_id);
    }
    if (mqttClient.connected()) {
        Serial.print("Publishing ");

        Serial.print(" to ");
        Serial.print(topic);
        Serial.print("...");
        result = mqttClient.publish(topic, value, retained);
        Serial.println(result ? "OK" : "FAIL");
    }
    return result;
}

void loop(void)
