use unit constants
This commit is contained in:
parent
70761270e2
commit
e2fbd8f799
12
src/bme680.h
12
src/bme680.h
@ -45,12 +45,12 @@ public:
|
||||
if (bme.remainingReadingMillis() == 0) {
|
||||
if (bme.endReading()) {
|
||||
const auto humidityAbsolute = calculateHumidityAbsolute(bme.temperature, bme.humidity);
|
||||
mqttPublish(name + "/temperature", bme.temperature, "\xB0""C");
|
||||
mqttPublish(name + "/pressure", bme.pressure / 100.0, "hPa");
|
||||
mqttPublish(name + "/humidity/relative", bme.humidity, "%");
|
||||
mqttPublish(name + "/humidity/absolute", humidityAbsolute, "mg/L");
|
||||
mqttPublish(name + "/gas", bme.gas_resistance / 1000.0, "KOhms");
|
||||
mqttPublish(name + "/altitude", bme.readAltitude(1013.25), "m");
|
||||
mqttPublish(name + "/temperature", bme.temperature, "TEMPERATURE_CELSIUS");
|
||||
mqttPublish(name + "/pressure", bme.pressure / 100.0, "PRESSURE_HPA");
|
||||
mqttPublish(name + "/humidity/relative", bme.humidity, "HUMIDITY_RELATIVE_PERCENT");
|
||||
mqttPublish(name + "/humidity/absolute", humidityAbsolute, "HUMIDITY_ABSOLUTE_MGL");
|
||||
mqttPublish(name + "/gas", bme.gas_resistance, "RESISTANCE_OHMS");
|
||||
mqttPublish(name + "/altitude", bme.readAltitude(1013.25), "ALTITUDE_M");
|
||||
} else {
|
||||
Log.printf("BME680 \"%s\": Failed to complete reading\n", name.c_str());
|
||||
setup();
|
||||
|
||||
@ -48,7 +48,7 @@ private:
|
||||
Log.printf("TSL2561 \"%s\": Failed to read.\n", name.c_str());
|
||||
setup();
|
||||
} else {
|
||||
mqttPublish(name + "/illuminance", illuminance, "lux");
|
||||
mqttPublish(name + "/illuminance", illuminance, "ILLUMINANCE_LUX");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user