Skip to content

Commit

Permalink
Fix Acurite-590TX timings (closes #3040)
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Aug 26, 2024
1 parent d0142bb commit 82539be
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[111] Emos TTX201 Temperature Sensor
[112] Ambient Weather TX-8300 Temperature/Humidity Sensor
[113] Ambient Weather WH31E Thermo-Hygrometer Sensor, EcoWitt WH40 rain gauge, WS68 weather station
[114] Maverick et73
[114] Maverick ET73
[115] Honeywell ActivLink, Wireless Doorbell
[116] Honeywell ActivLink, Wireless Doorbell (FSK)
[117]* ESA1000 / ESA2000 Energy Monitor
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 @@ -340,7 +340,7 @@ convert si
protocol 111 # Emos TTX201 Temperature Sensor
protocol 112 # Ambient Weather TX-8300 Temperature/Humidity Sensor
protocol 113 # Ambient Weather WH31E Thermo-Hygrometer Sensor, EcoWitt WH40 rain gauge, WS68 weather station
protocol 114 # Maverick et73
protocol 114 # Maverick ET73
protocol 115 # Honeywell ActivLink, Wireless Doorbell
protocol 116 # Honeywell ActivLink, Wireless Doorbell (FSK)
# protocol 117 # ESA1000 / ESA2000 Energy Monitor
Expand Down
59 changes: 27 additions & 32 deletions src/devices/acurite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1671,28 +1671,26 @@ static int acurite_606_decode(r_device *decoder, bitbuffer_t *bitbuffer)
}

/**
Acurite 590TX temperature/humidity sensor
Acurite 590TX temperature/humidity sensor.
The signal is OOK PPM with pulses of 500 us.
There is a sync pulse with a 3000 us gap, then 24 bits with 500 us / 1500 us gaps.
There is no packet gap -- the sync pulse will look like the 25th bit with 500 us gap.
A transmission contains 14 repeats.
We'll read the packet after the sync and treat the next sync as a trailing 0 bit
*/
static int acurite_590tx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t *b;
int row;
int sensor_id; // the sensor ID - basically a random number that gets reset whenever the battery is removed
int battery_ok; // the battery status: 1 is good, 0 is low
int channel;
int humidity;
int temp_raw; // temperature as read from the data packet
float temp_c; // temperature in C

row = bitbuffer_find_repeated_row(bitbuffer, 3, 25); // expected are min 3 rows
int row = bitbuffer_find_repeated_row(bitbuffer, 3, 25); // expected are min 3 rows
if (row < 0)
return DECODE_ABORT_EARLY;

if (bitbuffer->bits_per_row[row] > 25)
return DECODE_ABORT_LENGTH;

b = bitbuffer->bb[row];
uint8_t *b = bitbuffer->bb[row];

if (b[4] != 0) // last byte should be zero
return DECODE_FAIL_SANITY;
Expand All @@ -1714,23 +1712,21 @@ static int acurite_590tx_decode(r_device *decoder, bitbuffer_t *bitbuffer)
return DECODE_FAIL_MIC;
}

// Processing the temperature:
// Upper 4 bits are stored in nibble 1, lower 8 bits are stored in nibble 2
// upper 4 bits of nibble 1 are reserved for other usages (e.g. battery status)
sensor_id = b[0] & 0xFE; //first 6 bits and it changes each time it resets or change the battery
battery_ok = (b[0] & 0x01); //1=ok, 0=low battery
//next 2 bits are checksum
//next two bits are identify ID (maybe channel ?)
channel = (b[1] >> 4) & 0x03;
// the sensor ID - basically a random number that gets reset whenever the battery is removed
int sensor_id = b[0] & 0xFE; // first 6 bits and it changes each time it resets or change the battery
int battery_ok = (b[0] & 0x01); // 1=ok, 0=low battery
// upper 4 bits of byte 1 are parity and channel
int channel = (b[1] >> 4) & 0x03;

temp_raw = (int16_t)(((b[1] & 0x0F) << 12) | (b[2] << 4));
temp_raw = temp_raw >> 4;
temp_c = (temp_raw - 500) * 0.1f; // NOTE: there seems to be a 50 degree offset?
// Upper 4 temperature bits are stored in byte 1, lower 8 bits are stored in byte 2
int temp_raw = (int16_t)(((b[1] & 0x0F) << 12) | (b[2] << 4));
temp_raw = temp_raw >> 4; // sign-extend
float temp_c = (temp_raw - 500) * 0.1f; // a 50 degree offset

if (temp_raw >= 0 && temp_raw <= 100) // NOTE: no other way to differentiate humidity from temperature?
int humidity = -1;
if (temp_raw >= 0 && temp_raw <= 100) { // NOTE: no other way to differentiate humidity from temperature?
humidity = temp_raw;
else
humidity = -1;
}

/* clang-format off */
data_t *data = data_make(
Expand Down Expand Up @@ -2028,12 +2024,11 @@ r_device const acurite_00275rm = {

r_device const acurite_590tx = {
.name = "Acurite 590TX Temperature with optional Humidity",
.modulation = OOK_PULSE_PPM, // OOK_PULSE_PWM,
.short_width = 500, // short pulse is 232 us
.long_width = 1500, // long pulse is 420 us
.gap_limit = 1484, // long gap is 384 us, sync gap is 592 us
.reset_limit = 3000, // no packet gap, sync gap is 592 us
.sync_width = 500, // sync pulse is 632 us
.modulation = OOK_PULSE_PPM,
.short_width = 500, // short gap is 500 us
.long_width = 1500, // long gap is 1500 us
.gap_limit = 2000, // (preceeding) sync gap is 3000 us
.reset_limit = 3500, // no packet gap, sync gap is 500 us
.decode_fn = &acurite_590tx_decode,
.fields = acurite_590_output_fields,
};
2 changes: 1 addition & 1 deletion src/devices/maverick_et73.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static char const *const output_fields[] = {
};

r_device const maverick_et73 = {
.name = "Maverick et73",
.name = "Maverick ET73",
.modulation = OOK_PULSE_PPM,
.short_width = 1050,
.long_width = 2050,
Expand Down
3 changes: 2 additions & 1 deletion src/devices/prologue.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
/** @fn int prologue_callback(r_device *decoder, bitbuffer_t *bitbuffer)
Prologue sensor protocol,
also FreeTec NC-7104 sensor for FreeTec Weatherstation NC-7102,
and Pearl NC-7159-675.
also Pearl NC-7159-675,
also TFA pool thermometer 30.3240.10 #2651
The sensor can be bought at Clas Ohlson.
Note: this is a false positive for AlectoV1.
Expand Down

0 comments on commit 82539be

Please sign in to comment.