Skip to content

Commit 9535d13

Browse files
joel-bourquardroot@rpi
authored andcommitted
Add support for TFA Dostmann 14.1504 Radio-controlled grill and meat thermometer (merbanan#2296)
Co-authored-by: root@rpi <[email protected]>
1 parent 722e311 commit 9535d13

File tree

5 files changed

+144
-0
lines changed

5 files changed

+144
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
314314
[229]* WEC-2103 temperature/humidity sensor
315315
[230] Vauno EN8822C
316316
[231] Govee Water Leak Detector H5054
317+
[232] TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer
317318
318319
* Disabled by default, use -R n or a conf file to enable
319320

conf/rtl_433.example.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,14 @@ stop_after_successful_events false
447447
protocol 223 # Badger ORION water meter, 100kbps (-f 916.45M -s 1200k)
448448
protocol 224 # GEO minim+ energy monitor
449449
protocol 225 # TyreGuard 400 TPMS
450+
<<<<<<< HEAD
450451
protocol 226 # Kia TPMS (-s 1000k)
451452
protocol 227 # SRSmith Pool Light Remote Control SRS-2C-TX (-f 915M)
452453
protocol 228 # Neptune R900 flow meters
453454
# protocol 229 # WEC-2103 temperature/humidity sensor
454455
protocol 230 # Vauno EN8822C
455456
protocol 231 # Govee Water Leak Detector H5054
457+
protocol 232 # TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer
456458

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

include/rtl_433_devices.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
DECL(wec2103) \
240240
DECL(vauno_en8822c) \
241241
DECL(govee_h5054) \
242+
DECL(tfa_14_1504_v2) \
242243

243244
/* Add new decoders here. */
244245

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ add_library(r_433 STATIC
206206
devices/srsmith_pool_srs_2c_tx.c
207207
devices/steelmate.c
208208
devices/telldus_ft0385r.c
209+
devices/tfa_14_1504_v2.c
209210
devices/tfa_30_3196.c
210211
devices/tfa_30_3221.c
211212
devices/tfa_drop_30.3233.c

src/devices/tfa_14_1504_v2.c

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/** @file
2+
Decoder for TFA Dostmann 14.1504.V2 (30.3254.01)
3+
Radio-controlled grill and meat thermometer
4+
5+
Copyright (C) 2022-2023 Joël Bourquard <[email protected]>
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
*/
12+
13+
/**
14+
Decoder for TFA Dostmann 14.1504.V2 (30.3254.01)
15+
16+
CAUTION: Do not confuse with TFA Dostmann 14.1504 (30.3201) which had a completely different protocol => [71] Maverick ET-732/733 BBQ Sensor
17+
18+
Payload format:
19+
- Preamble {36} 0x7aaaaaa5c (for robustness we only use the tail: {24}0xaaaa5c)
20+
- Flags {4} OR between: 0x2=battery ok, 0x5=resync button
21+
- Temperature {12} Raw temperature value. Temperature in ºC = (value/4)-532. Example: 0x8a0 = 20 ºC
22+
- Separator {8} 0xff (differs if resync)
23+
- Digest {16} 16-bit LFSR digest + final XOR
24+
25+
To get raw data:
26+
```
27+
rtl_433 -R 0 -X 'n=TFA-141504v2,m=FSK_PCM,s=360,l=360,r=4096,preamble={24}aaaa5c'
28+
```
29+
30+
Example payloads (excluding preamble):
31+
- Resync = 7052f9cee3 (encoding differs from temperature readings => not handled)
32+
- No probe = 2700ffb791 (just like a temperature reading => in this case we report the appropriate probe status and no temperature reading)
33+
- ...
34+
- 20 ºC = 28a0ffce69
35+
- 21 ºC = 28a4ffa0f5
36+
- ...
37+
- 24 ºC = 28b0ff6438
38+
- ...
39+
- 44 ºC = 2900ff8c9d
40+
- ...
41+
*/
42+
43+
#include "decoder.h"
44+
45+
#define NUM_BITS_PREAMBLE 24
46+
#define NUM_BYTES_DATA 5
47+
#define OFFSET_MIC (NUM_BYTES_DATA - 2)
48+
#define NUM_BITS_DATA (NUM_BYTES_DATA * 8)
49+
#define NUM_BITS_TOTAL (NUM_BITS_PREAMBLE + NUM_BITS_DATA)
50+
#define NUM_BITS_MAX (NUM_BITS_TOTAL + 12)
51+
52+
static int tfa_14_1504_v2_callback(r_device *decoder, bitbuffer_t *bitbuffer)
53+
{
54+
uint8_t const preamble[] = {
55+
0xaa, 0xaa, 0x5c,
56+
};
57+
58+
if (bitbuffer->num_rows != 1) {
59+
return DECODE_ABORT_EARLY;
60+
}
61+
unsigned const row = 0;
62+
63+
// Optional optimization: Early exit if row too short
64+
if (bitbuffer->bits_per_row[row] < NUM_BITS_TOTAL) {
65+
return DECODE_ABORT_EARLY; // considered "early" because preamble not checked
66+
}
67+
68+
// Sync on preamble
69+
unsigned start_pos = bitbuffer_search(bitbuffer, row, 0, preamble, NUM_BITS_PREAMBLE);
70+
71+
if (start_pos == bitbuffer->bits_per_row[row]) {
72+
return DECODE_ABORT_EARLY; // no preamble detected
73+
}
74+
75+
const unsigned available_bits = bitbuffer->bits_per_row[row] - start_pos;
76+
77+
// check min length
78+
if (available_bits < NUM_BITS_TOTAL ||
79+
available_bits > NUM_BITS_MAX) {
80+
return DECODE_ABORT_LENGTH;
81+
}
82+
83+
uint8_t data[NUM_BYTES_DATA];
84+
bitbuffer_extract_bytes(bitbuffer, row, start_pos + NUM_BITS_PREAMBLE, data, NUM_BITS_DATA);
85+
86+
uint8_t flags = data[0] >> 4;
87+
// ignore resync button
88+
if ((flags & 0x5) == 0x5) {
89+
return DECODE_FAIL_SANITY;
90+
}
91+
unsigned battery_ok = (flags & 0x2) != 0;
92+
93+
if (data[2] != 0xff) {
94+
return DECODE_FAIL_SANITY;
95+
}
96+
97+
uint16_t calc_mic = lfsr_digest16(data, OFFSET_MIC, 0x8810, 0x0d42) ^ 0x16eb;
98+
uint16_t data_mic = (data[OFFSET_MIC] << 8) + data[OFFSET_MIC+1];
99+
if (calc_mic != data_mic) {
100+
return DECODE_FAIL_MIC;
101+
}
102+
103+
// we discard the last 2 bits as those are always zero
104+
uint16_t raw_temp_c = ((data[0] & 0xf) << 6) + (data[1] >> 2);
105+
unsigned is_probe_connected = (raw_temp_c != 0x1c0);
106+
float temp_c = ((int)raw_temp_c) - 532;
107+
108+
/* clang-format off */
109+
data_t *output = data_make(
110+
"model", "", DATA_STRING, "TFA-141504v2",
111+
"battery_ok", "Battery", DATA_INT, battery_ok,
112+
"probe_fail", "Probe failure", DATA_INT, !is_probe_connected,
113+
"temperature_C", "Temperature", DATA_COND, is_probe_connected, DATA_FORMAT, "%.0f C", DATA_DOUBLE, temp_c,
114+
"mic", "Integrity", DATA_STRING, "CRC",
115+
NULL);
116+
/* clang-format on */
117+
118+
decoder_output_data(decoder, output);
119+
return 1;
120+
}
121+
122+
static char *output_fields[] = {
123+
"model",
124+
"battery_ok",
125+
"probe_fail",
126+
"temperature_C",
127+
"mic",
128+
NULL,
129+
};
130+
131+
r_device tfa_14_1504_v2 = {
132+
.name = "TFA Dostmann 14.1504.V2 Radio-controlled grill and meat thermometer",
133+
.modulation = FSK_PULSE_PCM,
134+
.short_width = 360,
135+
.long_width = 360,
136+
.reset_limit = 4096,
137+
.decode_fn = &tfa_14_1504_v2_callback,
138+
.fields = output_fields,
139+
};

0 commit comments

Comments
 (0)