From 1b79671de81b78ba0a62024f854f6a876ffc3ab5 Mon Sep 17 00:00:00 2001 From: Matthias Prinke Date: Mon, 27 Jan 2025 17:52:08 +0100 Subject: [PATCH] Initial support of Bresser 8-in-1 weather sensor --- .../BresserWeatherSensorTest/BresserWeatherSensorTest.ino | 8 ++++++-- src/WeatherSensor.h | 1 + src/WeatherSensorDecoders.cpp | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/BresserWeatherSensorTest/BresserWeatherSensorTest.ino b/examples/BresserWeatherSensorTest/BresserWeatherSensorTest.ino index 3cf09918..5f4c3660 100644 --- a/examples/BresserWeatherSensorTest/BresserWeatherSensorTest.ino +++ b/examples/BresserWeatherSensorTest/BresserWeatherSensorTest.ino @@ -98,7 +98,11 @@ const uint8_t testData[][MSG_BUF_SIZE-1] = { // #10: Air Quality (HCHO/VOC) Sensor {0x0c, 0x1c, 0xc4, 0xa5, 0xaa, 0xaf, 0xb1, 0xaa, 0xa8, 0xaa, 0xa8, 0xaa, 0xa8, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xe9, 0xff, 0xaa, 0xaa, 0x00} + 0xaa, 0xaa, 0xe9, 0xff, 0xaa, 0xaa, 0x00}, + + // #11: 8-in-1 Weather Sensor + {0x6E, 0xA7, 0xC8, 0xEB, 0x88, 0x2A, 0xD8, 0xAD, 0xAA, 0xFD, 0xAA, 0xA8, 0x98, 0xAA, 0xBF, 0xFC, 0x3E, 0xAA, 0x82, + 0x22, 0xAA, 0xAA, 0xBE, 0x3A, 0xAA, 0x00} }; WeatherSensor ws; @@ -127,7 +131,7 @@ void loop() // Timeout occurs after a small multiple of expected time-on-air. DecodeStatus decode_status = ws.decodeMessage(&testData[idx][0], MSG_BUF_SIZE-1); - idx = (idx == 10) ? 0 : idx+1; + idx = (idx == 12) ? 0 : idx+1; Serial.printf("testData[%d]\n", idx); if (decode_status == DECODE_OK) { diff --git a/src/WeatherSensor.h b/src/WeatherSensor.h index e4341a1b..9e1ac256 100644 --- a/src/WeatherSensor.h +++ b/src/WeatherSensor.h @@ -125,6 +125,7 @@ #define SENSOR_TYPE_LIGHTNING 9 // Lightning Sensor #define SENSOR_TYPE_CO2 10 // CO2 Sensor #define SENSOR_TYPE_HCHO_VOC 11 // Air Quality Sensor (HCHO and VOC) +#define SENSOR_TYPE_WEATHER2 13 // Weather Station (8-in-1) // Sensor specific rain gauge overflow threshold (mm) diff --git a/src/WeatherSensorDecoders.cpp b/src/WeatherSensorDecoders.cpp index e6f505ef..5f12311d 100644 --- a/src/WeatherSensorDecoders.cpp +++ b/src/WeatherSensorDecoders.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// -// WeatherSensorDecoder.cpp +// WeatherSensorDecoders.cpp // // Sensor data decoding functions // @@ -752,7 +752,7 @@ DecodeStatus WeatherSensor::decodeBresser7In1Payload(const uint8_t *msg, uint8_t sensor[slot].complete = true; sensor[slot].rssi = rssi; - if (s_type == SENSOR_TYPE_WEATHER1) + if ((s_type == SENSOR_TYPE_WEATHER1) || (s_type == SENSOR_TYPE_WEATHER2)) { int wdir = (msgw[4] >> 4) * 100 + (msgw[4] & 0x0f) * 10 + (msgw[5] >> 4); int wgst_raw = (msgw[7] >> 4) * 100 + (msgw[7] & 0x0f) * 10 + (msgw[8] >> 4); @@ -1026,4 +1026,4 @@ DecodeStatus WeatherSensor::decodeBresserLeakagePayload(const uint8_t *msg, uint return DECODE_OK; } -#endif \ No newline at end of file +#endif