Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature additional aqs data #140

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
// 20230804 Added Bresser Water Leakage Sensor decoder
// 20231023 Modified detection of Lightning Sensor
// 20231025 Added Bresser Air Quality (Particulate Matter) Sensor decoder
// 20240209 Added Leakage, Air Quality (HCHO/VOC) and CO2 Sensors
// 20240213 Added PM1.0 to Air Quality (Particulate Matter) Sensor decoder
//
// ToDo:
// -
Expand Down Expand Up @@ -112,6 +114,11 @@ void loop()
}
else if (ws.sensor[i].s_type == SENSOR_TYPE_AIR_PM) {
// Air Quality (Particular Matter) Sensor
if (ws.sensor[i].pm.pm_1_0_init) {
Serial.printf("PM1.0: [init] ");
} else {
Serial.printf("PM1.0: [%uµg/m³] ", ws.sensor[i].pm.pm_1_0);
}
if (ws.sensor[i].pm.pm_2_5_init) {
Serial.printf("PM2.5: [init] ");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
// 20231228 Fixed entering sleep mode before sensor data was published
// 20240113 Added post-processed lightning data to payload
// 20240122 Added lightning post-processing reset
// 20240209 Added Leakage, Air Quality (HCHO/VOC) and CO2 Sensors
// 20240213 Added PM1.0 to Air Quality (Particulate Matter) Sensor decoder
//
// ToDo:
//
Expand Down Expand Up @@ -589,9 +591,11 @@ void publishWeatherdata(bool complete)
}
else if (weatherSensor.sensor[i].s_type == SENSOR_TYPE_AIR_PM) {
// Air Quality (Particular Matter) Sensor
if (!weatherSensor.sensor[i].pm.pm_1_0_init) {
mqtt_payload += String(",\"pm1_0_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_1_0);
}
if (!weatherSensor.sensor[i].pm.pm_2_5_init) {
mqtt_payload += String(",\"pm2_5_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_2_5);

}
if (!weatherSensor.sensor[i].pm.pm_10_init) {
mqtt_payload += String(",\"pm10_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,11 @@ void publishWeatherdata(bool complete)
}
else if (weatherSensor.sensor[i].s_type == SENSOR_TYPE_AIR_PM) {
// Air Quality (Particular Matter) Sensor
if (!weatherSensor.sensor[i].pm.pm_1_0_init) {
mqtt_payload += String(",\"pm1_0_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_1_0);
}
if (!weatherSensor.sensor[i].pm.pm_2_5_init) {
mqtt_payload += String(",\"pm2_5_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_2_5);

}
if (!weatherSensor.sensor[i].pm.pm_10_init) {
mqtt_payload += String(",\"pm10_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_10);
Expand Down
9 changes: 9 additions & 0 deletions examples/BresserWeatherSensorMQTTCustom/src/WeatherSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
// 20240208 Added sensors for CO2, P/N 7009977 and HCHO/VOC, P/N 7009978 to 7-in-1 decoder
// see https://github.com/merbanan/rtl_433/pull/2815
// & https://github.com/merbanan/rtl_433/pull/2817
// 20240213 Added PM1.0 to air quality (PM) sensor decoder
//
// ToDo:
// -
Expand Down Expand Up @@ -1205,8 +1206,16 @@ DecodeStatus WeatherSensor::decodeBresser7In1Payload(const uint8_t *msg, uint8_t
}
else if (s_type == SENSOR_TYPE_AIR_PM)
{
#if CORE_DEBUG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
uint16_t pn1 = (msgw[14] & 0x0f) * 1000 + (msgw[15] >> 4) * 100 + (msgw[15] & 0x0f) * 10 + (msgw[16] >> 4);
uint16_t pn2 = (msgw[17] >> 4) * 100 + (msgw[17] & 0x0f) * 10 + (msgw[18] >> 4);
uint16_t pn3 = (msgw[19] >> 4) * 100 + (msgw[19] & 0x0f) * 10 + (msgw[20] >> 4);
#endif
log_d("PN1: %04d PN2: %04d PN3: %04d", pn1, pn2, pn3);
sensor[slot].pm.pm_1_0 = (msgw[8] & 0x0f) * 1000 + (msgw[9] >> 4) * 100 + (msgw[9] & 0x0f) * 10 + (msgw[10] >> 4);
sensor[slot].pm.pm_2_5 = (msgw[10] & 0x0f) * 1000 + (msgw[11] >> 4) * 100 + (msgw[11] & 0x0f) * 10 + (msgw[12] >> 4);
sensor[slot].pm.pm_10 = (msgw[12] & 0x0f) * 1000 + (msgw[13] >> 4) * 100 + (msgw[13] & 0x0f) * 10 + (msgw[14] >> 4);
sensor[slot].pm.pm_1_0_init = ((msgw[10] >> 4) & 0x0f) == 0x0f;
sensor[slot].pm.pm_2_5_init = ((msgw[12] >> 4) & 0x0f) == 0x0f;
sensor[slot].pm.pm_10_init = ((msgw[14] >> 4) & 0x0f) == 0x0f;
}
Expand Down
3 changes: 3 additions & 0 deletions examples/BresserWeatherSensorMQTTCustom/src/WeatherSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
// 20240207 Added sensors for CO2, P/N 7009977 and HCHO/VOC, P/N 7009978
// see https://github.com/merbanan/rtl_433/pull/2815
// & https://github.com/merbanan/rtl_433/pull/2817
// 20240213 Added PM1.0 to air quality (PM) sensor decoder
//
// ToDo:
// -
Expand Down Expand Up @@ -247,8 +248,10 @@ class WeatherSensor {
};

struct AirPM {
uint16_t pm_1_0; //!< air quality PM1.0 in µg/m³
uint16_t pm_2_5; //!< air quality PM2.5 in µg/m³
uint16_t pm_10; //!< air quality PM10 in µg/m³
uint16_t pm_1_0_init; //!< measurement value invalid due to initialization
bool pm_2_5_init; //!< measurement value invalid due to initialization
bool pm_10_init; //!< measurement value invalid due to initialization
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
// 20240122 Added lightning post-processing reset
// 20240129 Replaced SPIFFS by LittleFS
// Added formatting of LittleFS partition if mounting failed
// 20240209 Added Leakage, Air Quality (HCHO/VOC) and CO2 Sensors
// 20240213 Added PM1.0 to Air Quality (Particulate Matter) Sensor decoder
//
// ToDo:
//
Expand Down Expand Up @@ -780,9 +782,11 @@ void publishWeatherdata(bool complete)
}
else if (weatherSensor.sensor[i].s_type == SENSOR_TYPE_AIR_PM) {
// Air Quality (Particular Matter) Sensor
if (!weatherSensor.sensor[i].pm.pm_1_0_init) {
mqtt_payload += String(",\"pm1_0_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_1_0);
}
if (!weatherSensor.sensor[i].pm.pm_2_5_init) {
mqtt_payload += String(",\"pm2_5_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_2_5);

}
if (!weatherSensor.sensor[i].pm.pm_10_init) {
mqtt_payload += String(",\"pm10_ug_m3\":") + String(weatherSensor.sensor[i].pm.pm_10);
Expand Down
9 changes: 9 additions & 0 deletions src/WeatherSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
// 20240208 Added sensors for CO2, P/N 7009977 and HCHO/VOC, P/N 7009978 to 7-in-1 decoder
// see https://github.com/merbanan/rtl_433/pull/2815
// & https://github.com/merbanan/rtl_433/pull/2817
// 20240213 Added PM1.0 to air quality (PM) sensor decoder
//
// ToDo:
// -
Expand Down Expand Up @@ -1205,8 +1206,16 @@ DecodeStatus WeatherSensor::decodeBresser7In1Payload(const uint8_t *msg, uint8_t
}
else if (s_type == SENSOR_TYPE_AIR_PM)
{
#if CORE_DEBUG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
uint16_t pn1 = (msgw[14] & 0x0f) * 1000 + (msgw[15] >> 4) * 100 + (msgw[15] & 0x0f) * 10 + (msgw[16] >> 4);
uint16_t pn2 = (msgw[17] >> 4) * 100 + (msgw[17] & 0x0f) * 10 + (msgw[18] >> 4);
uint16_t pn3 = (msgw[19] >> 4) * 100 + (msgw[19] & 0x0f) * 10 + (msgw[20] >> 4);
#endif
log_d("PN1: %04d PN2: %04d PN3: %04d", pn1, pn2, pn3);
sensor[slot].pm.pm_1_0 = (msgw[8] & 0x0f) * 1000 + (msgw[9] >> 4) * 100 + (msgw[9] & 0x0f) * 10 + (msgw[10] >> 4);
sensor[slot].pm.pm_2_5 = (msgw[10] & 0x0f) * 1000 + (msgw[11] >> 4) * 100 + (msgw[11] & 0x0f) * 10 + (msgw[12] >> 4);
sensor[slot].pm.pm_10 = (msgw[12] & 0x0f) * 1000 + (msgw[13] >> 4) * 100 + (msgw[13] & 0x0f) * 10 + (msgw[14] >> 4);
sensor[slot].pm.pm_1_0_init = ((msgw[10] >> 4) & 0x0f) == 0x0f;
sensor[slot].pm.pm_2_5_init = ((msgw[12] >> 4) & 0x0f) == 0x0f;
sensor[slot].pm.pm_10_init = ((msgw[14] >> 4) & 0x0f) == 0x0f;
}
Expand Down
3 changes: 3 additions & 0 deletions src/WeatherSensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
// 20240207 Added sensors for CO2, P/N 7009977 and HCHO/VOC, P/N 7009978
// see https://github.com/merbanan/rtl_433/pull/2815
// & https://github.com/merbanan/rtl_433/pull/2817
// 20240213 Added PM1.0 to air quality (PM) sensor decoder
//
// ToDo:
// -
Expand Down Expand Up @@ -247,8 +248,10 @@ class WeatherSensor {
};

struct AirPM {
uint16_t pm_1_0; //!< air quality PM1.0 in µg/m³
uint16_t pm_2_5; //!< air quality PM2.5 in µg/m³
uint16_t pm_10; //!< air quality PM10 in µg/m³
uint16_t pm_1_0_init; //!< measurement value invalid due to initialization
bool pm_2_5_init; //!< measurement value invalid due to initialization
bool pm_10_init; //!< measurement value invalid due to initialization
};
Expand Down
Loading