Skip to content

Commit fcdf538

Browse files
authored
Add support for Emax EM3551H with Gust without UV/Lux to Emax-W6 (#2376)
1 parent 88ae8f8 commit fcdf538

File tree

1 file changed

+65
-34
lines changed

1 file changed

+65
-34
lines changed

src/devices/emax.c

+65-34
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
Fuzhou Emax Electronic W6 Professional Weather Station.
1818
Rebrand and devices decoded :
19-
- Emax W6 / WEC-W6 / 3390TX W6 / EM3390W6
19+
- Emax W6 / WEC-W6 / 3390TX W6 / EM3390W6 / EM3551H
2020
- Altronics x7063/4
2121
- Optex 990040 / 990050 / 990051 / SM-040
2222
- Infactory FWS-1200
@@ -26,7 +26,7 @@ Rebrand and devices decoded :
2626
- Protmex PT3390A
2727
- Jula Marquant 014331 weather station /014332 temp hum sensor
2828
29-
S.a. issue #2000 #2299 #2326 PR #2300
29+
S.a. issue #2000 #2299 #2326 #2373 PR #2300 #2346 #2374
3030
3131
- Likely a rebranded device, sold by Altronics
3232
- Data length is 32 bytes with a preamble of 10 bytes (33 bytes for Rain/Wind Station)
@@ -64,10 +64,14 @@ Decoded example:
6464
aaa CH:1 ID:6e9 FLAGS:0101 TEMP:6b5 HUM:059 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa CHKSUM:d4 000
6565
6666
67-
Emax EM3390W6 Rain / Wind speed / Wind Direction / Temp / Hum / UV / Lux
67+
Emax Rain / Wind speed / Wind Direction / Temp / Hum / UV / Lux
68+
69+
Weather Rain/Wind station : humidity not at same byte position as temp/hum sensor.
70+
- With UV Lux without Wind Gust
71+
AA 04 II IB 0T TT HH 0W WW 0D DD RR RR UU LL LL 04 05 06 07 08 09 10 11 12 13 14 15 16 17 xx SS yy
72+
- Without UV / Lux , with Wind Gust
73+
AA 04 II IB 0T TT HH 0W WW 0D DD RR RR ?0 01 01 GG 04 05 06 07 08 09 10 11 12 13 14 15 16 xx SS yy
6874
69-
Weather Rain/Wind station : hummidity not at same byte position.
70-
AA 04 II IB 0T TT HH 0W WW 0D DD RR RR 0U LL LL 04 05 06 07 08 09 10 11 12 13 14 15 16 17 xx SS yy
7175
7276
default empty/null = 0x01 => value = 0
7377
@@ -82,6 +86,8 @@ default empty/null = 0x01 => value = 0
8286
- D: (9 bit) Wind Direction
8387
- U: (5 bit) UV index
8488
- L: (1 + 15 bit) Lux value, if first bit = 1 , then x 10 the rest.
89+
- G: (8 bit) Wind Gust
90+
- ?: unknown
8591
- A: (4 bit) fixed values of 0xA
8692
- 0: (4 bit) fixed values of 0x0
8793
- xx: incremental value each tx
@@ -184,36 +190,60 @@ static int emax_decode(r_device *decoder, bitbuffer_t *bitbuffer)
184190
int direction_deg = (((b[9] - 1) & 0x0f) << 8) | (b[10] - 1);
185191
int rain_raw = ((b[11] - 1) << 8 ) | (b[12] -1);
186192
float rain_mm = rain_raw * 0.2f;
187-
int uv_index = (b[13] - 1) & 0x1f;
188-
int lux_14 = (b[14] - 1) & 0xFF;
189-
int lux_15 = (b[15] - 1) & 0xFF;
190-
int lux_multi = ((lux_14 & 0x80) >> 7);
191-
int light_lux = ((lux_14 & 0x7f) << 8) | (lux_15);
192-
if (lux_multi == 1) {
193-
light_lux = light_lux * 10;
194-
}
195-
196-
/* clang-format off */
197-
data_t *data = data_make(
198-
"model", "", DATA_STRING, "Emax-W6",
199-
"id", "", DATA_FORMAT, "%03x", DATA_INT, id,
200-
"channel", "Channel", DATA_INT, channel,
201-
"battery_ok", "Battery_OK", DATA_INT, !battery_low,
202-
"temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, temp_f,
203-
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
204-
"wind_avg_km_h", "Wind avg speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, speed_kmh,
205-
"wind_dir_deg", "Wind Direction", DATA_INT, direction_deg,
206-
"rain_mm", "Total rainfall", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, rain_mm,
207-
"uv", "UV Index", DATA_FORMAT, "%u", DATA_INT, uv_index,
208-
"light_lux", "Lux", DATA_FORMAT, "%u", DATA_INT, light_lux,
209-
"pairing", "Pairing?", DATA_COND, pairing, DATA_INT, !!pairing,
210-
"mic", "Integrity", DATA_STRING, "CHECKSUM",
211-
NULL);
212-
/* clang-format on */
213-
214-
decoder_output_data(decoder, data);
215-
return 1;
216193

194+
if (b[29] == 0x17) { // with UV/Lux, without Wind Gust
195+
int uv_index = (b[13] - 1) & 0x1f;
196+
int lux_14 = (b[14] - 1) & 0xFF;
197+
int lux_15 = (b[15] - 1) & 0xFF;
198+
int lux_multi = ((lux_14 & 0x80) >> 7);
199+
int light_lux = ((lux_14 & 0x7f) << 8) | (lux_15);
200+
if (lux_multi == 1) {
201+
light_lux = light_lux * 10;
202+
}
203+
204+
/* clang-format off */
205+
data_t *data = data_make(
206+
"model", "", DATA_STRING, "Emax-W6",
207+
"id", "", DATA_FORMAT, "%03x", DATA_INT, id,
208+
"channel", "Channel", DATA_INT, channel,
209+
"battery_ok", "Battery_OK", DATA_INT, !battery_low,
210+
"temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, temp_f,
211+
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
212+
"wind_avg_km_h", "Wind avg speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, speed_kmh,
213+
"wind_dir_deg", "Wind Direction", DATA_INT, direction_deg,
214+
"rain_mm", "Total rainfall", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, rain_mm,
215+
"uv", "UV Index", DATA_FORMAT, "%u", DATA_INT, uv_index,
216+
"light_lux", "Lux", DATA_FORMAT, "%u", DATA_INT, light_lux,
217+
"pairing", "Pairing?", DATA_COND, pairing, DATA_INT, !!pairing,
218+
"mic", "Integrity", DATA_STRING, "CHECKSUM",
219+
NULL);
220+
/* clang-format on */
221+
222+
decoder_output_data(decoder, data);
223+
return 1;
224+
}
225+
if (b[29] == 0x16) { //without UV/Lux with Wind Gust
226+
float gust_kmh = b[16] / 1.5f;
227+
/* clang-format off */
228+
data_t *data = data_make(
229+
"model", "", DATA_STRING, "Emax-EM3551H",
230+
"id", "", DATA_FORMAT, "%03x", DATA_INT, id,
231+
"channel", "Channel", DATA_INT, channel,
232+
"battery_ok", "Battery_OK", DATA_INT, !battery_low,
233+
"temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, temp_f,
234+
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
235+
"wind_avg_km_h", "Wind avg speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, speed_kmh,
236+
"wind_max_km_h", "Wind max speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, gust_kmh,
237+
"wind_dir_deg", "Wind Direction", DATA_INT, direction_deg,
238+
"rain_mm", "Total rainfall", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, rain_mm,
239+
"pairing", "Pairing?", DATA_COND, pairing, DATA_INT, !!pairing,
240+
"mic", "Integrity", DATA_STRING, "CHECKSUM",
241+
NULL);
242+
/* clang-format on */
243+
244+
decoder_output_data(decoder, data);
245+
return 1;
246+
}
217247
}
218248
pos += EMAX_MESSAGE_BITLEN;
219249
}
@@ -228,6 +258,7 @@ static char const *output_fields[] = {
228258
"temperature_F",
229259
"humidity",
230260
"wind_avg_km_h",
261+
"wind_max_km_h",
231262
"rain_mm",
232263
"wind_dir_deg",
233264
"uv",

0 commit comments

Comments
 (0)