Skip to content

Commit

Permalink
Add support for Geevon TX16-3 outdoor sensor
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Falcon <[email protected]>
  • Loading branch information
zuckschwerdt and FalconFour committed Apr 22, 2024
1 parent 10f2876 commit 99dbc11
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[255] Mueller Hot Rod water meter
[256] ThermoPro TP28b Super Long Range Wireless Meat Thermometer for Smoker BBQ Grill
[257] BMW Gen3 TPMS
[258] Geevon TX16-3
* Disabled by default, use -R n or a conf file to enable
Expand Down
4 changes: 3 additions & 1 deletion conf/rtl_433.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,13 @@ convert si
protocol 249 # Bresser lightning
protocol 250 # Schou 72543 Day Rain Gauge, Motonet MTX Rain, MarQuant Rain Gauge, TFA Dostmann 30.3252.01/47.3006.01 Rain Gauge and Thermometer, ADE WS1907
protocol 251 # Fine Offset / Ecowitt WH55 water leak sensor
protocol 252 # BMW Gen5 TPMS, multi-brand HUF, Continental, Schrader/Sensata
protocol 252 # BMW Gen4-Gen5 TPMS and Audi TPMS Pressure Alert, multi-brand HUF/Beru, Continental, Schrader/Sensata, Audi
protocol 253 # Watts WFHT-RF Thermostat
protocol 254 # Thermor DG950 weather station
protocol 255 # Mueller Hot Rod water meter
protocol 256 # ThermoPro TP28b Super Long Range Wireless Meat Thermometer for Smoker BBQ Grill
protocol 257 # BMW Gen3 TPMS
protocol 258 # Geevon TX16-3

## Flex devices (command line option "-X")

Expand Down
1 change: 1 addition & 0 deletions include/rtl_433_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
DECL(mueller_hotrod) \
DECL(thermopro_tp28b) \
DECL(tpms_bmwg3) \
DECL(geevon) \

/* Add new decoders here. */

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ add_library(r_433 STATIC
devices/funkbus.c
devices/gasmate_ba1008.c
devices/ge_coloreffects.c
devices/geevon.c
devices/generic_motion.c
devices/generic_remote.c
devices/generic_temperature_sensor.c
Expand Down
130 changes: 130 additions & 0 deletions src/devices/geevon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/** @file
Geevon TX16-3 Remote Outdoor Sensor with LCD Display.
Contributed by Matt Falcon <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/

#include "decoder.h"

/**
Geevon TX16-3 Remote Outdoor Sensor with LCD Display.
This device is a simple temperature/humidity transmitter with a small LCD display for local viewing.
The test packet represents:
- channel 1
- battery OK
- temperature of 62.6 Fahrenheit or 17 Celsius
- 43% relative humidity.
Data layout:
Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
IIIIIIII BxCCxxxx TTTTTTTT TTTT0000 HHHHHHHH FFFFFFFF FFFFFFFF FFFFFFFF CCCCCCCC
87 00 29 e0 2b aa 55 aa e8
- I: ID?
- B: Battery status (0 = good, 1 = low battery)
- C: Channel (0, 1, 2 as channels 1, 2, 3)
- T: Temperature - represented as ((degrees C * 10) + 500)
- H: Relative humidity - represented as percentage %
- F: Integrity check - 3 bytes are always 0xAA 0x55 0xAA
- X: CRC checksum (CRC-8 poly 0x31 init=0x7b)
Format string:
ID:8h BATT:b ?:b CHAN:2h FLAGS:4h TEMP_C:12d PAD:4h HUM:8d FIX:24h CRC:8h 1x
Example packets:
f4002ac039aa55aa11
f4002ab039aa55aa54
f4002aa039aa55aa28
f4002a9039aa55aaac
*/

static int geevon_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
// invert all the bits
bitbuffer_invert(bitbuffer);

// in lieu of knowing the checksum algorithm, simply find the most common row
int r = bitbuffer_find_repeated_row(bitbuffer, bitbuffer->num_rows > 5 ? 5 : bitbuffer->num_rows, 64);
if (r < 0) {
r = bitbuffer_find_repeated_row(bitbuffer, 2, 64); // 65
}
if (r < 0) {
return DECODE_ABORT_LENGTH;
}

// work with the best/most repeated capture
uint8_t *b = bitbuffer->bb[r];

// Check if the packet has the correct number of bits
if (bitbuffer->bits_per_row[r] != 73){

Check failure on line 70 in src/devices/geevon.c

View workflow job for this annotation

GitHub Actions / Check code style

STICKY-BRACE error

Check failure on line 70 in src/devices/geevon.c

View workflow job for this annotation

GitHub Actions / Check code style

STICKY-BRACE error
return DECODE_ABORT_LENGTH;
}

// Check if the fixed bytes are correct
if (b[5] != 0xAA || b[6] != 0x55 || b[7] != 0xAA) {
return DECODE_FAIL_MIC;
}

// Verify CRC checksum
uint8_t chk = crc8(b, 9, 0x31, 0x7b);
if (chk) {
return DECODE_FAIL_MIC;
}

// Extract the data from the packet
int battery_low = (b[1] & 0x80) ? 0 : 1; // battery good: 1; bad: 0
int channel = ((b[1] & 0x30) >> 4) + 1; // channel: 1, 2, 3
int temp_raw = (b[2] << 4) | (b[3] >> 4);
float temp_c = (temp_raw - 500) * 0.1f; // temperature is ((degrees c + 500) * 10)
int humidity = b[4];
// int checksum = b[8];

// Store the decoded data
/* clang-format off */
data_t *data = data_make(
"model", "", DATA_STRING, "Geevon-TX163",
"id", "", DATA_INT, b[0],
"battery_ok", "Battery", DATA_INT, !battery_low,
"channel", "Channel", DATA_INT, channel,
"temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
"mic", "Integrity", DATA_STRING, "CRC",
NULL);
/* clang-format on */

decoder_output_data(decoder, data);
return 1;
}

static char const *const output_fields[] = {
"model",
"battery",
"channel",
"temperature_C",
"humidity",
"mic",
NULL,
};

r_device const geevon = {
.name = "Geevon TX16-3 outdoor sensor",
.modulation = OOK_PULSE_PWM,
.short_width = 250,
.long_width = 500,
.sync_width = 750, // sync pulse is 728 us + 728 us gap
.gap_limit = 625, // long gap (with short pulse) is ~472 us, sync gap is ~728 us
.reset_limit = 1700, // maximum gap is 1250 us (long gap + longer sync gap on last repeat)
.decode_fn = &geevon_callback,
.fields = output_fields,
};

0 comments on commit 99dbc11

Please sign in to comment.