Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Grill Thermometer (RF-T0912) #2746

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conf/rtl_433.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ convert si
# protocol 248 # Nissan TPMS
protocol 249 # Bresser lightning
protocol 250 # Schou 72543 Day Rain Gauge, Motonet MTX Rain, MarQuant Rain Gauge
protocol 251 # RF-T0912 Grill Thermometer

## 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 @@ -258,6 +258,7 @@
DECL(tpms_nissan) \
DECL(bresser_lightning) \
DECL(schou_72543_rain) \
DECL(grill_thermometer) \

/* 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 @@ -126,6 +126,7 @@ add_library(r_433 STATIC
devices/generic_temperature_sensor.c
devices/geo_minim.c
devices/govee.c
devices/grill_thermometer.c
devices/gt_tmbbq05.c
devices/gt_wt_02.c
devices/gt_wt_03.c
Expand Down
109 changes: 109 additions & 0 deletions src/devices/grill_thermometer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/** @file
Remote Grill Thermometer temperature sensor.

Copyright (C) 2023 Ethan Halsall

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.
*/
/** @fn int grill_thermometer_decode(r_device *decoder, bitbuffer_t *bitbuffer)
Remote Grill Thermometer -- Generic wireless thermometer with probe.

This is a meat thermometer with no brand / model identification except the FCC ID.

Manufacturer:
- Yangzhou Fupond Electronic Technology Corp., Ltd

Supported Models:
- RF-T0912 (FCC ID TXRFPT0912)

9 - 415 F, frequency 434.052 MHz

Data structure:

10 repetitions of the same 24 bit payload.

AAAAAAAA AAAAAAAA BBBBBBBB

- A: 16 bit temperature in Fahrenheit. Big Endian.
- B: Checksum of A

*/

#include "decoder.h"

static int grill_thermometer_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
short temp_f = 0;
int overload = 0;
int repeats = 0;
uint8_t checksum = 0;

bitbuffer_invert(bitbuffer);

// use the most recent "valid" data that repeats more than once
for (int row = 0; row < bitbuffer->num_rows; row++) {
uint8_t *row_data = bitbuffer->bb[row];
checksum = row_data[0] + row_data[1];

if (bitbuffer->bits_per_row[row] != 24 ||
checksum != row_data[2] ||
checksum == 0) {
continue;
}

short current_value = (row_data[0] << 8) + row_data[1];
eshaz marked this conversation as resolved.
Show resolved Hide resolved

if (temp_f != current_value) {
temp_f = current_value;
repeats = 0;
}
else {
repeats++;
}
}

if (repeats < 1) {
return DECODE_ABORT_EARLY;
}

if (temp_f == -1029) {
temp_f = 0;
overload = 1;
}

/* clang-format off */
data_t *data = data_make(
"model", "", DATA_STRING, "RF-T0912",
"temperature_F", "Temperature", DATA_FORMAT, "%i F", DATA_INT, temp_f,
eshaz marked this conversation as resolved.
Show resolved Hide resolved
"overload", "Overload", DATA_STRING, overload ? "true" : "false",
eshaz marked this conversation as resolved.
Show resolved Hide resolved
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
/* clang-format on */

decoder_output_data(decoder, data);
return 1;
}

static char const *const output_fields[] = {
"model",
"temperature_F",
"overload",
"mic",
NULL,
};

r_device const grill_thermometer = {
.name = "RF-T0912 Grill Thermometer",
.modulation = OOK_PULSE_PWM,
.short_width = 252,
.long_width = 736,
.gap_limit = 5000,
.reset_limit = 8068,
.sync_width = 980,
.priority = 10, // lower decode priority due to potential false positives
.decode_fn = &grill_thermometer_decode,
.fields = output_fields,
};
Loading