Skip to content

Commit

Permalink
Add support for Fine Offset WN32B (closes #2303)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Dec 25, 2023
1 parent cf4c74d commit 83afc7b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[75] LaCrosse TX35DTH-IT, TFA Dostmann 30.3155 Temperature/Humidity sensor
[76] LaCrosse TX29IT, TFA Dostmann 30.3159.IT Temperature sensor
[77] Vaillant calorMatic VRT340f Central Heating Control
[78] Fine Offset Electronics, WH25, WH32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
[78] Fine Offset Electronics, WH25, WH32, WH32B, WN32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
[79] Fine Offset Electronics, WH0530 Temperature/Rain Sensor
[80] IBIS beacon
[81] Oil Ultrasonic STANDARD FSK
Expand Down
2 changes: 1 addition & 1 deletion conf/rtl_433.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ convert si
protocol 75 # LaCrosse TX35DTH-IT, TFA Dostmann 30.3155 Temperature/Humidity sensor
protocol 76 # LaCrosse TX29IT, TFA Dostmann 30.3159.IT Temperature sensor
protocol 77 # Vaillant calorMatic VRT340f Central Heating Control
protocol 78 # Fine Offset Electronics, WH25, WH32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
protocol 78 # Fine Offset Electronics, WH25, WH32, WH32B, WN32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
protocol 79 # Fine Offset Electronics, WH0530 Temperature/Rain Sensor
protocol 80 # IBIS beacon
protocol 81 # Oil Ultrasonic STANDARD FSK
Expand Down
20 changes: 13 additions & 7 deletions src/devices/fineoffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ static int fineoffset_WH0290_callback(r_device *decoder, bitbuffer_t *bitbuffer)
}

/**
Fine Offset Electronics WH25 / WH32B Temperature/Humidity/Pressure sensor protocol.
Fine Offset Electronics WH25 / WH32 / WH32B / WN32B Temperature/Humidity/Pressure sensor protocol.
The sensor sends a package each ~64 s with a width of ~28 ms. The bits are PCM modulated with Frequency Shift Keying.
Expand Down Expand Up @@ -474,9 +474,15 @@ static int fineoffset_WH25_callback(r_device *decoder, bitbuffer_t *bitbuffer)
unsigned bit_offset;

// Validate package
if (bitbuffer->bits_per_row[0] < 190) {
if (bitbuffer->bits_per_row[0] < 160) {
// Nominal length of WH0290 is 129 bits
return fineoffset_WH0290_callback(decoder, bitbuffer); // abort and try WH0290
} else if (bitbuffer->bits_per_row[0] < 440) { // Nominal size is 488 bit periods
}
else if (bitbuffer->bits_per_row[0] < 190) {
// Nominal length of WN32B is 173 bits
type = 32; // new WN32B
}
else if (bitbuffer->bits_per_row[0] < 440) { // Nominal size is 488 bit periods
return fineoffset_WH24_callback(decoder, bitbuffer); // abort and try WH24, WH65B, HP1000
}

Expand All @@ -485,14 +491,14 @@ static int fineoffset_WH25_callback(r_device *decoder, bitbuffer_t *bitbuffer)
}

// Find a data package and extract data payload
// Normal index of WH25 is 367, and 123, 570 for WH32B
// skip some bytes to find faster
bit_offset = bitbuffer_search(bitbuffer, 0, 100, preamble, sizeof(preamble) * 8) + sizeof(preamble) * 8;
// Nominal index of WH25 is 367, and 123, 570 for WH32B
bit_offset = bitbuffer_search(bitbuffer, 0, 0, preamble, sizeof(preamble) * 8) + sizeof(preamble) * 8;
if (bit_offset + sizeof(b) * 8 > bitbuffer->bits_per_row[0]) { // Did not find a big enough package
decoder_logf_bitbuffer(decoder, 1, __func__, bitbuffer, "short package. Header index: %u", bit_offset);
return DECODE_ABORT_LENGTH;
}
bitbuffer_extract_bytes(bitbuffer, 0, bit_offset, b, sizeof(b) * 8);
decoder_log_bitrow(decoder, 2, __func__, b, sizeof(b) * 8, "Packet");

// Verify type code
int msg_type = b[0] & 0xf0;
Expand Down Expand Up @@ -1020,7 +1026,7 @@ r_device const fineoffset_WH2 = {
};

r_device const fineoffset_WH25 = {
.name = "Fine Offset Electronics, WH25, WH32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor",
.name = "Fine Offset Electronics, WH25, WH32, WH32B, WN32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor",
.modulation = FSK_PULSE_PCM,
.short_width = 58, // Bit width = 58µs (measured across 580 samples / 40 bits / 250 kHz)
.long_width = 58, // NRZ encoding (bit width = pulse width)
Expand Down

0 comments on commit 83afc7b

Please sign in to comment.