Skip to content

Commit 7cc048a

Browse files
authored
Merge pull request #2871 from ProfBoc75/patch-ws68
Correct EcoWitt WS68 Wind unit and decoding
2 parents a8fe08c + 8f5dead commit 7cc048a

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/devices/ambientweather_wh31e.c

+17-16
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,20 @@ Samples with 0.9V battery (last 3 samples contain 1 manual bucket tip)
158158
Ecowitt WS68 Anemometer protocol with LUX and UVI.
159159
160160
Units confirmed from issue #2786 , LUX and UVI decoding as well
161+
Wind unit and decoding from issue #2867
161162
162163
Data layout:
163164
164-
TYPE:8h ?8h ID:16h LUX:16h BATT:8h WDIR_H:4h 4h8h8h WSPEED:8h WDIR_LO:8h WGUST:8h UVI:8h CRC:8h SUM:8h ?8h4h
165+
TYPE:8h ?8h ID:16h LUX:16h BATT:8d ?1b WGUST_MSB:1b WDIR_MSB:1b WSPEED_MSB:1b ?4h 8h8h WSPEED_LSB:8d WDIR_LSB:8h WGUST_LSB:8d UVI:8h CRC:8h SUM:8h ?8h4h
165166
166167
Some payloads:
167-
TT ??II II LLLL BB WDH WS WDLWG UV CCSS ???
168-
68 0000 c5 0000 4b 0f ffff 00 5a 00 00 d0af 104
169-
68 0000 c5 0000 4b 0f ffff 00 b4 00 00 79b2 102
170-
68 0000 c5 0000 4b 0f ffff 7e e0 94 00 75ec 102
171-
68 0000 c5 0000 4b 2f ffff 00 0e 00 00 8033 208
172-
68 0000 c5 000f 4b 0f ffff 00 2e 00 00 d395 108
173-
68 0000 c5 0107 4b 0f ffff 00 2e 00 02 a663 100
168+
TT ?? IIII LLLL BB WH f ffff WSL WDL WGL UV CC SS ???
169+
68 00 00c5 0000 4b 0 f ffff 00 5a 00 00 d0 af 104
170+
68 00 00c5 0000 4b 0 f ffff 00 b4 00 00 79 b2 102
171+
68 00 00c5 0000 4b 0 f ffff 7e e0 94 00 75 ec 102
172+
68 00 00c5 0000 4b 2 f ffff 00 0e 00 00 80 33 208
173+
68 00 00c5 000f 4b 0 f ffff 00 2e 00 00 d3 95 108
174+
68 00 00c5 0107 4b 0 f ffff 00 2e 00 02 a6 63 100
174175
175176
*/
176177

@@ -333,9 +334,9 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
333334
int light_lux = lux_raw * 10;
334335
int batt = b[6];
335336
int batt_ok = batt > 0x20; // wild guess
336-
int wspeed = b[10];
337-
int wgust = b[12];
338-
int wdir = ((b[7] & 0x20) >> 5) | b[11];
337+
int wspeed = ((b[7] & 0x10) << 4) | (b[10]);
338+
int wdir = ((b[7] & 0x20) << 3) | (b[11]);
339+
int wgust = ((b[7] & 0x40) << 2) | (b[12]);
339340
int uvindex = (int)b[13] * 0.1f;
340341
char extra[4];
341342
snprintf(extra, sizeof(extra), "%02x%01x", b[16], b[17] >> 4);
@@ -346,9 +347,9 @@ static int ambientweather_whx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
346347
"id" , "", DATA_INT, id,
347348
"battery_raw", "Battery Raw", DATA_INT, batt,
348349
"battery_ok", "Battery OK", DATA_INT, batt_ok,
349-
"light_lux", "Lux", DATA_FORMAT, "%u lux", DATA_INT, light_lux,
350-
"wind_avg_km_h", "Wind Speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, (double)wspeed,
351-
"wind_max_km_h", "Wind Gust", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, (double)wgust,
350+
"light_lux", "Lux", DATA_FORMAT, "%u lux", DATA_INT, light_lux,
351+
"wind_avg_m_s", "Wind Speed", DATA_FORMAT, "%.1f m/s", DATA_DOUBLE, wspeed * 0.1f,
352+
"wind_max_m_s", "Wind Gust", DATA_FORMAT, "%.1f m/s", DATA_DOUBLE, wgust * 0.1f,
352353
"uvi", "UVI", DATA_INT, uvindex,
353354
"wind_dir_deg", "Wind dir", DATA_INT, wdir,
354355
"data", "Extra Data", DATA_STRING, extra,
@@ -377,8 +378,8 @@ static char const *const output_fields[] = {
377378
"rain_mm",
378379
"uvi",
379380
"light_lux",
380-
"wind_avg_km_h",
381-
"wind_max_km_h",
381+
"wind_avg_m_s",
382+
"wind_max_m_s",
382383
"wind_dir_deg",
383384
"data",
384385
"radio_clock",

0 commit comments

Comments
 (0)