Clean up TFA 30.3221.02
This commit is contained in:
parent
57b015b569
commit
67b0131a42
9 changed files with 63 additions and 37 deletions
|
@ -237,7 +237,8 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
|
|||
[161] Interval Data Message (IDM) for Net Meters
|
||||
[162]* ThermoPro-TX2 temperature sensor
|
||||
[163] Acurite 590TX Temperature with optional Humidity
|
||||
[164] Security+ 2.0 (Keyfob)
|
||||
[164] Security+ 2.0 (Keyfob)
|
||||
[165] TFA Dostmann 30.3221.02 T/H Outdoor Sensor
|
||||
|
||||
* Disabled by default, use -R n or -G
|
||||
|
||||
|
|
|
@ -345,6 +345,8 @@ stop_after_successful_events false
|
|||
protocol 161 # Interval Data Message (IDM) for Net Meters
|
||||
# protocol 162 # ThermoPro-TX2 temperature sensor
|
||||
protocol 163 # Acurite 590TX Temperature with optional Humidity
|
||||
protocol 164 # Security+ 2.0 (Keyfob)
|
||||
protocol 165 # TFA Dostmann 30.3221.02 T/H Outdoor Sensor
|
||||
|
||||
## Flex devices (command line option "-X")
|
||||
|
||||
|
|
|
@ -612,7 +612,10 @@ Interval Data Message (IDM) for Net Meters
|
|||
Acurite 590TX Temperature with optional Humidity
|
||||
.TP
|
||||
[ \fB164\fI\fP ]
|
||||
Security+ 2.0 (Keyfob)
|
||||
Security+ 2.0 (Keyfob)
|
||||
.TP
|
||||
[ \fB165\fI\fP ]
|
||||
TFA Dostmann 30.3221.02 T/H Outdoor Sensor
|
||||
|
||||
* Disabled by default, use \-R n or \-G
|
||||
.SS "Input device selection"
|
||||
|
|
|
@ -142,6 +142,7 @@ add_library(r_433 STATIC
|
|||
devices/springfield.c
|
||||
devices/steelmate.c
|
||||
devices/tfa_30_3196.c
|
||||
devices/tfa_30_3221.c
|
||||
devices/tfa_drop_30.3233.c
|
||||
devices/tfa_pool_thermometer.c
|
||||
devices/tfa_twin_plus_30.3049.c
|
||||
|
@ -168,7 +169,6 @@ add_library(r_433 STATIC
|
|||
devices/wt450.c
|
||||
devices/x10_rf.c
|
||||
devices/x10_sec.c
|
||||
devices/tfa_30_3221.c
|
||||
)
|
||||
|
||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
|
|
|
@ -141,6 +141,7 @@ rtl_433_SOURCES = abuf.c \
|
|||
devices/springfield.c \
|
||||
devices/steelmate.c \
|
||||
devices/tfa_30_3196.c \
|
||||
devices/tfa_30_3221.c \
|
||||
devices/tfa_drop_30.3233.c \
|
||||
devices/tfa_pool_thermometer.c \
|
||||
devices/tfa_twin_plus_30.3049.c \
|
||||
|
|
|
@ -397,7 +397,7 @@ static int secplus_v2_callback(r_device *decoder, bitbuffer_t *bitbuffer)
|
|||
|
||||
// rolling_total is a 28 bit unsigned number
|
||||
// fixed_totals is 40 bit in a uint64_t
|
||||
snprintf(fixed_str, sizeof(fixed_str), "%lu", fixed_total);
|
||||
snprintf(fixed_str, sizeof(fixed_str), "%llu", fixed_total);
|
||||
snprintf(rolling_str, sizeof(rolling_str), "%u", rolling_total);
|
||||
|
||||
/* clang-format off */
|
||||
|
@ -431,7 +431,7 @@ static char *output_fields[] = {
|
|||
// -X "n=vI3,m=OOK_PCM,s=230,l=230,t=40,r=10000,g=7400,match={24}0xaaaa9560"
|
||||
|
||||
r_device secplus_v2 = {
|
||||
.name = "Security+ 2.0 (Keyfob) ",
|
||||
.name = "Security+ 2.0 (Keyfob)",
|
||||
.modulation = OOK_PULSE_PCM_RZ,
|
||||
.short_width = 250,
|
||||
.long_width = 250,
|
||||
|
|
|
@ -1,26 +1,32 @@
|
|||
/** @file
|
||||
TFA 30.3221.02 decoder
|
||||
Temperature/Humidity outdoor sensor TFA 30.3221.02.
|
||||
|
||||
Copyright (C) 2020 Odessa Claude
|
||||
|
||||
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.
|
||||
*/
|
||||
/*
|
||||
Temperature/Humidity outdoor sensor TFA 30.3221.02
|
||||
-------------------------------------------------------------------------------------------------
|
||||
source : https://github.com/RFD-FHEM/RFFHEM/blob/master/FHEM/14_SD_WS.pm
|
||||
0 4 | 8 12 | 16 20 | 24 28 | 32 36
|
||||
/**
|
||||
Temperature/Humidity outdoor sensor TFA 30.3221.02.
|
||||
|
||||
S.a. https://github.com/RFD-FHEM/RFFHEM/blob/master/FHEM/14_SD_WS.pm
|
||||
|
||||
0 4 | 8 12 | 16 20 | 24 28 | 32 36
|
||||
--------- | --------- | --------- | --------- | ---------
|
||||
0000 1001 | 0001 0110 | 0001 0000 | 0000 0111 | 0100 1001
|
||||
iiii iiii | bscc tttt | tttt tttt | hhhh hhhh | ???? ????
|
||||
i: 8 bit random id (changes on power-loss)
|
||||
b: 1 bit battery indicator (0=>OK, 1=>LOW)
|
||||
s: 1 bit sendmode (0=>auto, 1=>manual)
|
||||
c: 2 bit channel valid channels are 0-2 (1-3)
|
||||
t: 12 bit unsigned temperature, offset 500, scaled by 10
|
||||
h: 8 bit relative humidity percentage
|
||||
?: 8 bit unknown
|
||||
The sensor sends 3 repetitions at intervals of about 60 seconds
|
||||
|
||||
- i: 8 bit random id (changes on power-loss)
|
||||
- b: 1 bit battery indicator (0=>OK, 1=>LOW)
|
||||
- s: 1 bit sendmode (0=>auto, 1=>manual)
|
||||
- c: 2 bit channel valid channels are 0-2 (1-3)
|
||||
- t: 12 bit unsigned temperature, offset 500, scaled by 10
|
||||
- h: 8 bit relative humidity percentage
|
||||
- ?: 8 bit checksum digest 0x31, 0xf4
|
||||
|
||||
The sensor sends 3 repetitions at intervals of about 60 seconds.
|
||||
*/
|
||||
|
||||
#include "decoder.h"
|
||||
|
@ -28,44 +34,53 @@
|
|||
static int tfa_303221_callback(r_device *decoder, bitbuffer_t *bitbuffer)
|
||||
{
|
||||
int row, sendmode, channel, battery_low, temp_raw, humidity;
|
||||
double temp_c;
|
||||
float temp_c;
|
||||
data_t *data;
|
||||
uint8_t *bytes;
|
||||
uint8_t *b;
|
||||
unsigned int device;
|
||||
|
||||
/* Device send 4 row, checking for two repeated */
|
||||
// Device send 4 row, checking for two repeated
|
||||
row = bitbuffer_find_repeated_row(bitbuffer, (bitbuffer->num_rows > 4) ? 4 : 2, 40);
|
||||
|
||||
/* Checking for right number of bits per row*/
|
||||
// Checking for right number of bits per row
|
||||
if (bitbuffer->bits_per_row[0] != 41)
|
||||
return DECODE_ABORT_LENGTH;
|
||||
|
||||
bitbuffer_invert(bitbuffer);
|
||||
bytes = bitbuffer->bb[row];
|
||||
b = bitbuffer->bb[row];
|
||||
|
||||
device = bytes[0];
|
||||
device = b[0];
|
||||
|
||||
/* Sanity Check */
|
||||
// Sanity Check
|
||||
if (device == 0)
|
||||
return DECODE_FAIL_SANITY;
|
||||
|
||||
temp_raw = ((bytes[1] & 0x0F) << 8) | bytes[2];
|
||||
temp_c = (double)(temp_raw - 500)/10;
|
||||
humidity = bytes[3];
|
||||
battery_low = bytes[1] >> 7;
|
||||
channel = ((bytes[1] >> 4) & 3) + 1;
|
||||
sendmode = (bytes[1] >> 6) & 1;
|
||||
// Validate checksum
|
||||
int observed_checksum = b[4];
|
||||
int computed_checksum = lfsr_digest8_reflect(b, 4, 0x31, 0xf4);
|
||||
if (observed_checksum != computed_checksum) {
|
||||
return DECODE_FAIL_MIC;
|
||||
}
|
||||
|
||||
temp_raw = ((b[1] & 0x0F) << 8) | b[2];
|
||||
temp_c = (float)(temp_raw - 500) * 0.1f;
|
||||
humidity = b[3];
|
||||
battery_low = b[1] >> 7;
|
||||
channel = ((b[1] >> 4) & 3) + 1;
|
||||
sendmode = (b[1] >> 6) & 1;
|
||||
|
||||
/* clang-format off */
|
||||
data = data_make(
|
||||
"model", "", DATA_STRING, "TFA-30322102",
|
||||
"model", "", DATA_STRING, "TFA-303221",
|
||||
"id", "Sensor ID", DATA_INT, device,
|
||||
"channel", "Channel", DATA_INT, channel,
|
||||
"battery_ok", "Battery", DATA_INT, !battery_low,
|
||||
"temperature_C", "Temperature", DATA_FORMAT, "%.2f C", DATA_DOUBLE, temp_c,
|
||||
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
|
||||
"sendmode", "Test ?", DATA_STRING, sendmode ? "Yes" : "No",
|
||||
"sendmode", "Test mode", DATA_INT, sendmode,
|
||||
"mic", "Integrity", DATA_STRING, "CRC",
|
||||
NULL);
|
||||
/* clang-format on */
|
||||
|
||||
decoder_output_data(decoder, data);
|
||||
return 1;
|
||||
|
@ -79,17 +94,17 @@ static char *output_fields[] = {
|
|||
"temperature_C",
|
||||
"humidity",
|
||||
"sendmode",
|
||||
"mic",
|
||||
NULL,
|
||||
};
|
||||
|
||||
r_device tfa_30_3221 = {
|
||||
.name = "TFA Dostmann 30.3221 T/H Outdoor Sensor",
|
||||
.name = "TFA Dostmann 30.3221.02 T/H Outdoor Sensor",
|
||||
.modulation = OOK_PULSE_PWM,
|
||||
.short_width = 235,
|
||||
.long_width = 480,
|
||||
.reset_limit = 850,
|
||||
.sync_width = 836,
|
||||
.decode_fn = &tfa_303221_callback,
|
||||
.disabled = 0,
|
||||
.fields = output_fields,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -265,6 +265,7 @@ COPY ..\..\libusb\MS64\dll\libusb*.dll $(TargetDir)</Command>
|
|||
<ClCompile Include="..\src\devices\springfield.c" />
|
||||
<ClCompile Include="..\src\devices\steelmate.c" />
|
||||
<ClCompile Include="..\src\devices\tfa_30_3196.c" />
|
||||
<ClCompile Include="..\src\devices\tfa_30_3221.c" />
|
||||
<ClCompile Include="..\src\devices\tfa_drop_30.3233.c" />
|
||||
<ClCompile Include="..\src\devices\tfa_pool_thermometer.c" />
|
||||
<ClCompile Include="..\src\devices\tfa_twin_plus_30.3049.c" />
|
||||
|
|
|
@ -532,6 +532,9 @@
|
|||
<ClCompile Include="..\src\devices\tfa_30_3196.c">
|
||||
<Filter>Source Files\devices</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\devices\tfa_30_3221.c">
|
||||
<Filter>Source Files\devices</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\devices\tfa_drop_30.3233.c">
|
||||
<Filter>Source Files\devices</Filter>
|
||||
</ClCompile>
|
||||
|
|
Loading…
Add table
Reference in a new issue